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 Quote Link to comment 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". Quote Link to comment 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.