Posting data to a dbase from a dropdown box
Posted: Wed Jan 05, 2005 2:42 pm
ive got a dropdown box, that takes a column from a database and inserts the values:
But i want to have the information posted to the database when i click the submit button. so then instead of typing the name of the person every time you can select it out of the box. i cant figure out how to do it though. help is appreciated.
Code: Select all
<?php
$query = "SELECT name FROM names";
$result = @mysql_query ($query);
if ($result) {
echo '<form><select name="names">';
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
echo "<option value="$rowї0]">$rowї0]\n";
}
echo '</select></form>';
mysql_free_result ($result);
} else {
echo '<p>The box could not be created due to a system error. Please try again later.</p>';
}
mysql_close();
?>