I have this code that is supposed to create a drop down box that shows a list of names each name has a number assosiated with it inside a table. so what i want to do is to make it so that the user selects a name from the box and then enters the rest of the information and clicks submit and then the name in the drop down box would be transfered into the database as a number so that when i want to i can call all of the information from this form and display it in a nice neat format. sofar the dropdown box only shows one name and it does not have any functionality (it doesn't assosiate the name with the number). i would prefer it to all be done in php/js/html not ajax or anything if that is possible
<?php
mysql_connect("localhost", "email", "qwe") or die(mysql_error());
mysql_select_db("bhi_info") or die(mysql_error());
$sql = mysql_query("SELECT pastor_id, fname FROM pastors_info") or die(mysql_error());
while($row=mysql_fetch_array($sql)) {
$id=$row["pastor_id"];
$thing=$row["fname"];
$item="<OPTION VALUE=\"$id\">".$thing.'</option>';
}
?>
<body onload="document.add_church.pastor_id.focus()">
<form action="submit_churches.php" name="add_church" method="post">
Pastor ID: <SELECT NAME="pastor_id">
<OPTION VALUE=0>Choose
<?php=$item?>
</SELECT>
<br />
Address: <input type="text" name="c_address" AUTOCOMPLETE=OFF /><br />
City: <input type="text" name="c_city" AUTOCOMPLETE=OFF /><br />
District: <input type="text" name="c_district" AUTOCOMPLETE=OFF /><br />
Postal Code: <input type="text" name="c_pc" AUTOCOMPLETE=OFF /><br />
State: <input type="text" name="c_state" AUTOCOMPLETE=OFF /><br />
Landline Number: <input type="text" name="c_landline" AUTOCOMPLETE=OFF /><br />
Notes: <input type="text" name="c_notes" AUTOCOMPLETE=OFF /><br />
<br/>
<input type="submit" value="Add Contact" /> <input type="reset" Value ="Clear Fields">
</form>
</body>