Jump to content

Getting post data from a selection box :(


tieeem

Recommended Posts

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

 

Link to comment
https://forums.phpfreaks.com/topic/168097-getting-post-data-from-a-selection-box/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.