Forum Moderators: coopster

Message Too Old, No Replies

Select multiple records using checkbox to update in mysql

update mysql checkbox

         

nailonthehead

6:49 am on May 31, 2007 (gmt 0)

10+ Year Member



Hallo.
I have an application that uses mysql database. Several records are retrived from the database. To enable users to select multiple records, I've used checkboxes by the side of each record. However, the checkbox does not retrieve their value from the database, neither do they update the database.

I just thought that by setting the value of the checkbox, I could determine the selected checkboxes and insert the corresponding records into the database.

The selected records whose checboxes have been set are then inserted into another table. Or updated as I may also need to update some.

My problem,however, is how to determine the selected records and then do multiple inserts into the database table?

Any help offerd will be highly appreciated.

Habtom

7:00 am on May 31, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<input type="checkbox" name="testname" value="v1" <?php if($value=='1'){ echo "checked=\"true\""; }?>>

This will result in the checkboxes with value to be checked.

You can have multiple inserts by looping through the checked boxes.

I hope this helps.

Habtom

nailonthehead

7:14 am on May 31, 2007 (gmt 0)

10+ Year Member



Thx Habtom, lt me try it out.