mrherman Posted February 25, 2010 Share Posted February 25, 2010 I'm stuck with a checkbox problem. I have a db that contains names and unique id numbers. There are thousands of rows. Using a query, I am pulling selected students and showing them to a user in an ultra simple HTML table on a form. Each row begins with a checkbox. The method is POST. So far, so good. My table kinda looks like this (very simplified): +-----------+----------+----------+ | SELECT | NAME | ID | +-----------+----------+----------+ | [] | John | 2233 | +-----------+----------+----------+ | [] | Susie | 5577 | +-----------+----------+----------+ [-SUBMIT-] My problem is that I cannot seem to make the selected checkboxes associate with each student's name and unique ID. Once the user has selected rows and clicked SUBMIT, the $_POST array remains empty. How can I get the values of the NAME and ID (etc.) when a checkbox is ticked?? Thanks for any help Quote Link to comment https://forums.phpfreaks.com/topic/193306-getting-table-row-data-based-on-ticked-checkbox/ Share on other sites More sharing options...
Psycho Posted February 25, 2010 Share Posted February 25, 2010 You should just need the ID, since the ID should be associated with all the details for the student. You should create the checkboxes as arrays and se the value as the ID of the record <input type="checkbox" name="students[]" value="<?php echo $row['id']; ?>" /> Quote Link to comment https://forums.phpfreaks.com/topic/193306-getting-table-row-data-based-on-ticked-checkbox/#findComment-1017891 Share on other sites More sharing options...
mrherman Posted February 25, 2010 Author Share Posted February 25, 2010 Thank you! I have been working on this for awhile. I'm sure I will have a follow-up question! Quote Link to comment https://forums.phpfreaks.com/topic/193306-getting-table-row-data-based-on-ticked-checkbox/#findComment-1018078 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.