elabuwa Posted January 9, 2011 Share Posted January 9, 2011 Hi guys, I have a list box. say the code is <select name="drop1" id="Select1" size="4" multiple="multiple"> <option value="1">item 1</option> <option value="2">item 2</option> <option value="3">item 3</option> <option value="4">item 4</option> <option value="0">All</option> </select> The user will select few items. How do i capture the data through the "POST" method. $data = $_POST['drop']; would not work coz there is an array if data. Can any one help or point me in the right direction? Thanks in advance Link to comment https://forums.phpfreaks.com/topic/223845-listbox-posting/ Share on other sites More sharing options...
nderevj Posted January 9, 2011 Share Posted January 9, 2011 A couple of things: 1) Append brackets to your select's name- drop1[]. This will tell PHP to create an array based on the submitted data. 2) Make sure your PHP code references the $_POST element with the same name, minus the brackets- $_POST['drop1']. Link to comment https://forums.phpfreaks.com/topic/223845-listbox-posting/#findComment-1156960 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.