concretegong
08-21-2007, 05:42 PM
Hi,
I am having problems with checkboxes (checked or not) and MySql - update multiple rows.
My aim is to have a user update multiple records based on the status of the checkbox.
The story so far...
I am using a do-while loop to generate a list of 'items' from my db.
Each 'item' has a checkbox next to it, with a value of item_id.
The database has a 'published' field (enum 'y','n'). When published='y' the item will appear on the site and conversely published='n' wont.
When the form is submitted the checkboxes make up the published[] array.
This is where I need to update each record in the database with either a 'y' or a 'n'.
It seems that by default checkboxes are not included in the $_POST superglobal unless they are checked, I need all the items in my array, checked or not, in order to update the db.
Hope that makes sense - its been a long day...:eek:
Thanks
I am having problems with checkboxes (checked or not) and MySql - update multiple rows.
My aim is to have a user update multiple records based on the status of the checkbox.
The story so far...
I am using a do-while loop to generate a list of 'items' from my db.
Each 'item' has a checkbox next to it, with a value of item_id.
The database has a 'published' field (enum 'y','n'). When published='y' the item will appear on the site and conversely published='n' wont.
When the form is submitted the checkboxes make up the published[] array.
This is where I need to update each record in the database with either a 'y' or a 'n'.
It seems that by default checkboxes are not included in the $_POST superglobal unless they are checked, I need all the items in my array, checked or not, in order to update the db.
Hope that makes sense - its been a long day...:eek:
Thanks