I am trying to put entered data into a selected table inside a database. For example(user enters their phone number and they select which state they are from in the drop down. that phone number is entered into that selected table(state).
here is some code i have
<?php
$state = $_POST['state'];
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("state", $con);
$sql=("INSERT INTO 'state'(phonenumber)")
VALUES
('$_POST[phonenumber]');
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
mysql_close($con)
?>
I have the drop down menu on a separate php page.
Thanks in advance for any help.