thebiff335 Posted April 17, 2013 Share Posted April 17, 2013 Hi there so I am working on a project and I have a drop down menu created but I can't seem to get it to echo the item that gets selected from the menu... echo "Select Id of Super or Function to edit";echo "<FORM METHOD ='POST'>";echo "<SELECT NAME='superList'>";echo "<option disabled selected>Id</option>";$q="SELECT * FROM box WHERE pid=0";$res=mysql_query($q);while($row=mysql_fetch_array($res)){echo "<option value>$row[0]</option>";}echo "</SELECT>";echo " <INPUT TYPE='Submit' VALUE='Select' NAME='superS' Title='Select Super/Function Box By Id' /></FORM>";if(isset($_POST['superS'])){$selected = $_REQUEST['superList'];echo "button works";echo $selected;} i have a test echo in my button and that displays but my $selected won't...any guidence would be appriciated Quote Link to comment Share on other sites More sharing options...
lemmin Posted April 17, 2013 Share Posted April 17, 2013 The option you have selected is set to disabled. The browser won't send the data of an input that is disabled. Quote Link to comment Share on other sites More sharing options...
thebiff335 Posted April 17, 2013 Author Share Posted April 17, 2013 That Option is just the name of my options so it shows as the default but you cant select it, when i tray selecting any other options in the menu it still won't echo them. Quote Link to comment Share on other sites More sharing options...
lemmin Posted April 17, 2013 Share Posted April 17, 2013 That is because you don't have a value set for any of the options. If you select something else, it IS sending the data, but the value is null (or an empty string). Try this: echo "<option value='$row[0]'>$row[0]</option>"; Quote Link to comment Share on other sites More sharing options...
thebiff335 Posted April 17, 2013 Author Share Posted April 17, 2013 That works perfectly thank you so much....its been driving me crazy 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.