tieeem Posted July 30, 2009 Share Posted July 30, 2009 Hey all, hope this is the right forum to post this in. I have a select box that connect to a database and shows a list of the items. I want to use $_post to get the option the user selects and then display this, however when I try display this its ALWAYS blank, it's annoying me, im about to hadouken my Mac out the window, can anyone help? here's my code..... ---delete.php---- <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("stock", $con); $query = mysql_query("SELECT brand FROM phonestock"); ?> <form action="new.php" method="post"> <select name="tink"> <option> test </option> <?php //for each row we get from mysql, echo a form input while ($row = mysql_fetch_array($query)) { echo "<option value=\"$row[model]\">$row[brand]</optio… } ?> </select> <input type="submit"name="Submit" value="Submit"> </form> ---new.php---- <?php echo $POST['tink']; ?> NOTHING APPEARS, IF I TYPE SOMETHING ELSE THO THAN IT WILL APPEAR?? The <select> list show fine so im baffled I tired putting 'brand' and 'model' inside '' marks however this just made the delete.php page display as blank... where as before it displayed the drop down box with a list of my items in it Quote Link to comment https://forums.phpfreaks.com/topic/168097-getting-post-data-from-a-selection-box/ Share on other sites More sharing options...
DaiLaughing Posted July 30, 2009 Share Posted July 30, 2009 Can you post the source code of the actual web page in your browser? Quote Link to comment https://forums.phpfreaks.com/topic/168097-getting-post-data-from-a-selection-box/#findComment-886617 Share on other sites More sharing options...
RichardRotterdam Posted July 30, 2009 Share Posted July 30, 2009 you didn't quote the values in the array This: echo "<option value=\"$row[model]\">$row[brand]</option>"; Should be like: echo "<option value=\"{$row['model']}\">{$row['brand']}</option>"; Quote Link to comment https://forums.phpfreaks.com/topic/168097-getting-post-data-from-a-selection-box/#findComment-886662 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.