Are you thinking about something like (off the top of my head, untested):

<input type=\"checkbox\" name=\"update[]\" value=\"".$row["personID"]."\"
checked>
<input type=\"checkbox\" name=\"delete[]\" value=\"".$row["personID"]."\"
checked>

for each of the people listed on your page?

Then, in the script that handles the updating stuff, you simply do a 

foreach($_POST["update"] as $value){
        $sql = "some UPDATE query using $value";
}

foreach($_POST["delete"] as $value){
        $sql = "some DELETE query using $value";
}

to send information to the database? Depending on your requirements, you
might need to determine whether the data should be DELETEd or UPDATEd, but
that's not too tough either.

One suggestion would be to consider using radio buttons instead of
checkboxes to prevent somebody from accidentally checking both DELETE and
UPDATE then causing some sort of problem.


Hope this helps.

P.S. What the heck does chocka mean?

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 04, 2004 8:36 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Multiple deletes and updates...
> 
> 
> I simply can't get my head round this today....
> Probably easy, but I've been chocka, and brain is melting...
> Anyhoo...
> 
> If I have a table, with say, id(unique, auto inc), name, email, 
> membership_type
> 
> I've listed them on a PHP page...
> I want to add a checkbox to each row, so that I can select 1 
> or all, and 
> then perform an action on ALL selected (Either Delete, or change 
> membership_type)
> I can do this with ease one by one, but I cant get my head 
> round to more 
> than one with one submit button...?
> 
> Can anyone nudge me in the right direction....?
> I've seen this on the list before, but couldn't find it in 
> the archive (I 
> may have imagined it?)
> 
> cheers,
> Tris...
> 
> 
> *********************************************************************
> The information contained in this e-mail message is intended only for 
> the personal and confidential use of the recipient(s) named above.  
> If the reader of this message is not the intended recipient 
> or an agent
> responsible for delivering it to the intended recipient, you 
> are hereby 
> notified that you have received this document in error and that any
> review, dissemination, distribution, or copying of this message is 
> strictly prohibited. If you have received this communication 
> in error, 
> please notify us immediately by e-mail, and delete the 
> original message.
> **************************************************************
> *********
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to