Jump to content

html checkboxes...


boo_lolly

Recommended Posts

hey all! i've got a CMS i'm working on and i have a couple of HTML tables that are populated via php loops communicating with the SQL database. got it? good.

at the end of each row in the HTML table there is a checkbox. i need to be able to click as many of them as i want, and then press "delete" and have them all be deleted, and then immediately returned to the exact same page.


each HTML table row is exactly like the SQL row. each row has an ID, so that is probably the way i'd identify each row (it's worked for me so far =P).

so can i get any advice, or direction. i'm almost positive i'm gonna have to store the value of the checkboxes in an array of somesort, somehow but i have NO idea where to even start. thanks!
Link to comment
https://forums.phpfreaks.com/topic/28024-html-checkboxes/
Share on other sites

For each checkbox name them in this manner
[b]name=delete[] value=$recordID[/b]

When you submit the form you will receive the value of $_POST[delete] as an array will all the boxes were checked. you could then just use a single delete query in the form

DELETE FROM table WHERE record_id IN ([i]comma separated values[/i])

I believe there is a command to convert an array into a comma separated list, otherwise you could just build it from the array.
Link to comment
https://forums.phpfreaks.com/topic/28024-html-checkboxes/#findComment-128197
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.