nahla123 Posted March 4, 2008 Share Posted March 4, 2008 Hi I need to know how to get checkbox value using php , i expect to have an array of results Link to comment https://forums.phpfreaks.com/topic/94224-bigenner-question/ Share on other sites More sharing options...
haku Posted March 4, 2008 Share Posted March 4, 2008 Give each checkbox the same name. The name should be followed with square brackets. Example: <input type="checkbox" name="example[]" value="box1" /> <input type="checkbox" name="example[]" value="box2" /> After the page is submitted, you will have a post array that holds an array called example. You can access it like this: $_POST['example'][index] It will hold all the values for the boxes that had checks in them. So if you were to check box one, then: $_POST['example'][1] would equal "box1". Link to comment https://forums.phpfreaks.com/topic/94224-bigenner-question/#findComment-482640 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.