Hi
im doing a basic form and posting the info to mysql db. ive got it working but ive added a dropdown menu to the form and cant post that info to mysql.just wondering if i could get help on this?
thanks
heres the code:
<?php
if(!isset($POST['submit']))
{
?>
<html>
<head>
<title>Insert Test</title>
</head>
<body>
<h1>Insert Test</h1>
<form action = "<?$SERVER['PHP_SELF']?>" method = "post">
<ol><li> First Name<input type = "text" size = "20" name = "first_name" /></li>
<li>Last Name<input type = "text" size = "20" name = "last_name" /></li>
<li>Address Line 1<input type = "text" size = "20" name = "addr_line_one" /></li>
<li>Address Line 2<input type = "text" size = "20" name = "addr_line_two" /></li>
<li>Town<input type = "text" size = "20" name = "town" /></li>
<li>County <select size="1" name="county">
<option>Antrim</option>
<option>Armagh</option>
<option>Cavan</option>
<option>Carlow</option>
</select></li>
<li>E-mail<input type = "text" size = "20" name = "email" /></li>
<li>Phone No<input type = "text" size = "20" name = "phone_no" /></li>
<li>Username<input type = "text" size = "20" name = "username" /></li>
<li><input type = "submit" name = "submit" value = "Click Here"></li>
</ol>
</form>
</body>
</html>
<?php
}
else
{
$db = mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("buyer", $db);
$buyer_first_name = $_POST['first_name'];
$buyer_last_name= $_POST['last_name'];
$buyer_addr_line_one= $_POST['addr_line_one'];
$buyer_addr_line_two= $_POST['addr_line_two'];
$buyer_town= $_POST['town'];
$buyer_county= $_POST['county'];
$buyer_email= $_POST['email'];
$buyer_phone_no= $_POST['phone_no'];
$buyer_username= $_POST['username'];
$query = mysql_query("insert into buyer_table(first_name, last_name, addr_line_one, addr_line_two, town, county, email, phone_no, username)values('$buyer_first_name','$buyer_last_name', '$buyer_addr_line_one', '$buyer_addr_line_two', '$buyer_town', '$buyer_county', '$buyer_email', '$buyer_phone_no','$buyer_username')");
echo "Data has been succesfully entered";
}
?>