Hello,
I have a table on a form which contains records that can be multiple selected by checkboxes. A submit button sucessfully sends the record IDs of the checked records to the next page.
I want to display the records that were selected via the checkboxes, but the problem is that I get only the first of them.
Any help would be really appreciated, thanks
Use checkboxes to display selected records
Moderator: General Moderators
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
you need to change your checkbox to be an array
Which will provide you an array of your values for fieldname[]
Code: Select all
<input type="checkbox" name="fieldname[]" value="foo">
<input type="checkbox" name="fieldname[]" value="bar">
<input type="checkbox" name="fieldname[]" value="foobar">
<?php
//on submit
echo '<pre>';
print_r($_POST['fieldname'])
?>