dwex Posted January 24, 2011 Share Posted January 24, 2011 the same page? Link to comment https://forums.phpfreaks.com/topic/225497-how-to-store-the-value-of-a-select-drop-down-menu-into-a-variable-within/ Share on other sites More sharing options...
litebearer Posted January 24, 2011 Share Posted January 24, 2011 Perhaps a little deeper explanation would help. Based upon what you have posted, why not store the various values into an array? Link to comment https://forums.phpfreaks.com/topic/225497-how-to-store-the-value-of-a-select-drop-down-menu-into-a-variable-within/#findComment-1164393 Share on other sites More sharing options...
mike12255 Posted January 24, 2011 Share Posted January 24, 2011 I can be sure what you are looking for, but I think its something like this: <?php $queury = "SELECT * FROM test"; $res = mysq_query($query) or die (mysql_error()) while ($row = mysql_fetch_array($res)){ echo "<option value = $row['id']>".$row['name']."</option"; } ?> Link to comment https://forums.phpfreaks.com/topic/225497-how-to-store-the-value-of-a-select-drop-down-menu-into-a-variable-within/#findComment-1164397 Share on other sites More sharing options...
dwex Posted January 24, 2011 Author Share Posted January 24, 2011 thx for the replies. I wanna store the value of the quantity select drop down box into a variable. <td valign="top"><b>Quantity: </b> <select name='quantity'> <?php for($i=1; $i<=$stk; $i++){ echo '<option name="$i[]">'; echo $i; echo '</option>'; } ?> </select></td> Link to comment https://forums.phpfreaks.com/topic/225497-how-to-store-the-value-of-a-select-drop-down-menu-into-a-variable-within/#findComment-1164449 Share on other sites More sharing options...
mike12255 Posted January 24, 2011 Share Posted January 24, 2011 is it inside a <form> if it is, then the variable for it once the forum is sent would be $_POST['quantity'] Link to comment https://forums.phpfreaks.com/topic/225497-how-to-store-the-value-of-a-select-drop-down-menu-into-a-variable-within/#findComment-1164452 Share on other sites More sharing options...
dwex Posted January 24, 2011 Author Share Posted January 24, 2011 thanks for the reply. Nevermind, it's kinda hard to explain this 1. Link to comment https://forums.phpfreaks.com/topic/225497-how-to-store-the-value-of-a-select-drop-down-menu-into-a-variable-within/#findComment-1164457 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.