Checkbox - get row ID

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
NeedHelpPlease
Forum Newbie
Posts: 1
Joined: Sat Mar 10, 2012 3:25 am

Checkbox - get row ID

Post by NeedHelpPlease »

Hello, I hope that someone will be able to help me or at least point me in the right direction.

I have a table, with values for each row being retrieved from a database.

I want to add a checkbox for each row which if selected will allow me to perform some further action (i.e. send an email to the person who's details are in the selected row).

How can I get the value of the ID field ($row[0]) for all rows that have been selected?

My original idea was to have a 'selected' field in the database and updating this for each row, every time a checkbox was changed - but this would not be a good solution as there would be conflicts if more that one user accessed the form at the same time.

Also I need the checkboxes that are selected to stay selected following a submit.

Thanks for any help you can offer

Regards

Ian
litebearer
Forum Contributor
Posts: 194
Joined: Sat Mar 27, 2004 5:54 am

Re: Checkbox - get row ID

Post by litebearer »

what code have you tried thus far?
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Checkbox - get row ID

Post by califdon »

It depends on how your HTML table was constructed and how you are submitting the data back to an action script, so without seeing your code, we can only guess or tell you generalities. So generally, when your initial code is creating the table with the dynamic data, it also includes the row number as part of the link back, or the HTML element tag, so that when it is submitted, the selected element will have the row number to return to the action script.
Post Reply