doubledee Posted September 30, 2011 Share Posted September 30, 2011 If I have a drop-down list... <select name="attendees"> <option value="">--</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> </select> Where does the value that the user selects get stored? Does it get stored in $_POST by default (if a Form is used)? What variable would hold the selected value? Debbie Link to comment https://forums.phpfreaks.com/topic/248152-where-does-drop-down-selection-get-assigned/ Share on other sites More sharing options...
Pikachu2000 Posted September 30, 2011 Share Posted September 30, 2011 It works just like any other form element. Link to comment https://forums.phpfreaks.com/topic/248152-where-does-drop-down-selection-get-assigned/#findComment-1274261 Share on other sites More sharing options...
doubledee Posted September 30, 2011 Author Share Posted September 30, 2011 It works just like any other form element. That being the values are stored in the Control's "Name" value? Debbie Link to comment https://forums.phpfreaks.com/topic/248152-where-does-drop-down-selection-get-assigned/#findComment-1274266 Share on other sites More sharing options...
Buddski Posted September 30, 2011 Share Posted September 30, 2011 Correct. So to get the selected value from your select example you would use $_POST['attendees'] Link to comment https://forums.phpfreaks.com/topic/248152-where-does-drop-down-selection-get-assigned/#findComment-1274270 Share on other sites More sharing options...
doubledee Posted September 30, 2011 Author Share Posted September 30, 2011 Correct. So to get the selected value from your select example you would use $_POST['attendees'] So the selected value gets assigned to whatever NAME in the Control you use, right? So if my <select> had no "name" attribute then things wouldn't work, right? Debbie Link to comment https://forums.phpfreaks.com/topic/248152-where-does-drop-down-selection-get-assigned/#findComment-1274274 Share on other sites More sharing options...
Buddski Posted September 30, 2011 Share Posted September 30, 2011 Yep. If there is no name attribute on a form element, it will not be posted with the form. Link to comment https://forums.phpfreaks.com/topic/248152-where-does-drop-down-selection-get-assigned/#findComment-1274277 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.