I am trying to make a php form that inserts data into a mysql database. THe problem
is that there is a record that gets put into the database but it is blank everytime.
here is the code:
<html>
<body>
<form method="post" action="conf.php">
First name:<input type="Text" name="First_Name"><br>
Last name:<input type="Text" name="Last_Name"><br>
Address:<input type="Text" name="How_Many"><br>
Position:<input type="Text" name="Children"><br>
Yes or No:<input type="Text" name="Y_N"><br>
Area Code:<input type="Text" name="Area_Code"><br>
Prefix:<input type="Text" name="Prefix"><br>
Number:<input type="Text" name="Number"><br>
<input type="Submit" name="submit" value="Enter information">
</form>
</body>
</html>
conf.php looks like this:
<?php
$First_Name = $_Post['First_Name'];
$Last_Name = $_Post['Last_Name'];
$How_Many = $_Post['How_Many'];
$Children = $_Post['Children'];
$Y_N = $_Post['Y_N'];
$Area_Code = $_Post['Area_Code'];
$Prefix = $_Post['Prefix'];
$Number = $_Post['Number'];
$db = mysql_connect("localhost", "root", "mypw"
mysql_select_db("randyrsvp",$db);
$sql = "INSERT INTO rsvp (First_Name, Last_Name, How_Many, Children, Y_N, Area_Code, Prefix, Number)
VALUES ('$First_Name','$Last_Name','$How_many','$Children
', '$Y_N','$Area_Code','$Prefix','$Number')";
$done = mysql_db_query("randyrsvp",$sql);
if ($done != '0')
{
echo "you have inserted a record";
}
else
{
echo"insert failed";
}
?>
Does anyone know why all I get is blank records in my database?
Thanks
is that there is a record that gets put into the database but it is blank everytime.
here is the code:
<html>
<body>
<form method="post" action="conf.php">
First name:<input type="Text" name="First_Name"><br>
Last name:<input type="Text" name="Last_Name"><br>
Address:<input type="Text" name="How_Many"><br>
Position:<input type="Text" name="Children"><br>
Yes or No:<input type="Text" name="Y_N"><br>
Area Code:<input type="Text" name="Area_Code"><br>
Prefix:<input type="Text" name="Prefix"><br>
Number:<input type="Text" name="Number"><br>
<input type="Submit" name="submit" value="Enter information">
</form>
</body>
</html>
conf.php looks like this:
<?php
$First_Name = $_Post['First_Name'];
$Last_Name = $_Post['Last_Name'];
$How_Many = $_Post['How_Many'];
$Children = $_Post['Children'];
$Y_N = $_Post['Y_N'];
$Area_Code = $_Post['Area_Code'];
$Prefix = $_Post['Prefix'];
$Number = $_Post['Number'];
$db = mysql_connect("localhost", "root", "mypw"
mysql_select_db("randyrsvp",$db);
$sql = "INSERT INTO rsvp (First_Name, Last_Name, How_Many, Children, Y_N, Area_Code, Prefix, Number)
VALUES ('$First_Name','$Last_Name','$How_many','$Children
', '$Y_N','$Area_Code','$Prefix','$Number')";
$done = mysql_db_query("randyrsvp",$sql);
if ($done != '0')
{
echo "you have inserted a record";
}
else
{
echo"insert failed";
}
?>
Does anyone know why all I get is blank records in my database?
Thanks