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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.