Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

form help

Status
Not open for further replies.

rjseals

Technical User
Nov 25, 2002
63
US
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=&quot;post&quot; action=&quot;conf.php&quot;>

First name:<input type=&quot;Text&quot; name=&quot;First_Name&quot;><br>

Last name:<input type=&quot;Text&quot; name=&quot;Last_Name&quot;><br>

Address:<input type=&quot;Text&quot; name=&quot;How_Many&quot;><br>

Position:<input type=&quot;Text&quot; name=&quot;Children&quot;><br>

Yes or No:<input type=&quot;Text&quot; name=&quot;Y_N&quot;><br>

Area Code:<input type=&quot;Text&quot; name=&quot;Area_Code&quot;><br>

Prefix:<input type=&quot;Text&quot; name=&quot;Prefix&quot;><br>

Number:<input type=&quot;Text&quot; name=&quot;Number&quot;><br>

<input type=&quot;Submit&quot; name=&quot;submit&quot; value=&quot;Enter information&quot;>

</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(&quot;localhost&quot;, &quot;root&quot;, &quot;mypw&quot;);

mysql_select_db(&quot;randyrsvp&quot;,$db);

$sql = &quot;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')&quot;;

$done = mysql_db_query(&quot;randyrsvp&quot;,$sql);

if ($done != '0')
{
echo &quot;you have inserted a record&quot;;
}
else
{
echo&quot;insert failed&quot;;
}

?>

Does anyone know why all I get is blank records in my database?

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top