bumdeal2 Posted August 22, 2011 Share Posted August 22, 2011 Hey guys, I have a drop down menu like so <select name="Categories[]"> <Option value="Horror" Name="Horror">Horror</Option> <Option value="Romance" Name="Romance">Romance</Option> ......................................... Like that, just out of interest once the user has selected the option I am unsure on how to extract what the user chose from the drop down menu, how do you grab the value from array of the drop down menu that the user has selected. Any help A.S.A.P would really be appreciated. It also has to be an array. I also thought of using the $_POST['Categories']; to try grab the value if that is the correct way to go about it. Thank you in advance. Quote Link to comment https://forums.phpfreaks.com/topic/245455-drop-down-menu-array-selecting-the-data/ Share on other sites More sharing options...
AbraCadaver Posted August 22, 2011 Share Posted August 22, 2011 I also thought of using the $_POST['Categories']; to try grab the value if that is the correct way to go about it. Yes, but there is no reason to have Categories[] as an array unless you allow multiple selections, which you are not at this point. And this is assuming that you have method="post" in your form. Quote Link to comment https://forums.phpfreaks.com/topic/245455-drop-down-menu-array-selecting-the-data/#findComment-1260686 Share on other sites More sharing options...
bumdeal2 Posted August 22, 2011 Author Share Posted August 22, 2011 Yes the form has a POST and the array is becasue im sending over multiple selections from a user as the menu will be displayed multiple times on one page. Quote Link to comment https://forums.phpfreaks.com/topic/245455-drop-down-menu-array-selecting-the-data/#findComment-1260687 Share on other sites More sharing options...
AbraCadaver Posted August 22, 2011 Share Posted August 22, 2011 Yes the form has a POST and the array is becasue im sending over multiple selections from a user as the menu will be displayed multiple times on one page. OK, then yes, use $_POST['Categories']. Quote Link to comment https://forums.phpfreaks.com/topic/245455-drop-down-menu-array-selecting-the-data/#findComment-1260694 Share on other sites More sharing options...
bumdeal2 Posted August 22, 2011 Author Share Posted August 22, 2011 Thank you for all the help. Quote Link to comment https://forums.phpfreaks.com/topic/245455-drop-down-menu-array-selecting-the-data/#findComment-1260698 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.