ksmatthews Posted February 14, 2007 Share Posted February 14, 2007 Hi There, I have set up the folowing simple checkbox within my form ... <label>Text <input name = "checkbox" type = "checkbox" value = "text" /></label> <label>Audio <input name = "checkbox" type = "checkbox" value = "audio" /></label> What I would like to know is how can I retrieve the values for EACH checkbox option server side ? When I use this code as it is, I am only able to retrieve ONE value for the name 'checkbox' ... but don't I have to keep name = "checkbox" the same ?? Any suggestions ? Steven Matthews Link to comment https://forums.phpfreaks.com/topic/38512-getting-back-all-my-checkbox-selections-in-php/ Share on other sites More sharing options...
Balmung-San Posted February 14, 2007 Share Posted February 14, 2007 No. You need to turn name="checkbox" to name="checkbox[]". Then on the server side it will come up as $_POST["checkbox"][]. So if the first is checked, $_POST["checkbox"][0] will have the value of "text". Link to comment https://forums.phpfreaks.com/topic/38512-getting-back-all-my-checkbox-selections-in-php/#findComment-184779 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.