Hello everyone. I'm trying to insert records in a table using a form in HTML. I also created the php file with the information. But I cannot insert any records to the database. I could connect successfully and I receive no error messages. But the data will not insert to the table. I have admin rights. This is MYSQL Server version: 4.1.14. Here is first the HTML code for the form;
<form name="email_list" action="emailme.php" method="post" >
<font color="#FF0000"> Email</font>:
<input type="text" name="email" size=40'>
Company:
<input type="text" name="company" size=20><br><br>
<font color="#FF0000">First Name</font>:
<input type="text" name="fname" size=15/>
Last Name:
<input type="text" name="lname" size=25/>
<br><br>Street/Box Address:
<input type="text" name="addr" size=35/>
Apt/Unit #:
<input type="text" name="unit" size=4/>
<br><br>City/Providence:
<input type="text" name="ctyname" size=35/>
State:
<input type="text" name="stname" size=2/>
Zip:
<input type="text" name="zip" size=6/><br><br>
Country:
<input type="text" name="country" size=25/>
<p><input type=submit name="submit" value="Submit"><input type="reset" name="Reset" value="Reset">
====================Here is the php file=================
<?
$ID_address=$_POST['id_address'];
$ID=$_POST['ID'];
$company=$_POST['company'];
$fname=$_POST['fname'];
$lname=$_POST['lname'];
$addr=$_POST['addr'];
$unit=$_POST['unit'];
$ctyname=$_POST['ctyname'];
$email=$_POST['email'];
$stname=$_POST['stname'];
$zip=$_POST['zip'];
$country=$_POST['country'];
$conn=mysql_connect("mysql", "userid", "password") or die(mysql_error());
mysql_select_db("thespianprada",$conn) or die(mysql_error());
mysql_query("INSERT INTO 'contacts' VALUES ('$id_address','$ID','$company','$fname', '$lname','$addr','$unit','$ctyname','$email', '$stname','$zip','country')");
Print "Your information has been successfully added to the database.";
?>
I'm sure what I can't insert in the table. Is there something wrong with the syntax for the INSERT command? I followed some tutorials and still get no results. Any assistance will be apreciated.
<form name="email_list" action="emailme.php" method="post" >
<font color="#FF0000"> Email</font>:
<input type="text" name="email" size=40'>
Company:
<input type="text" name="company" size=20><br><br>
<font color="#FF0000">First Name</font>:
<input type="text" name="fname" size=15/>
Last Name:
<input type="text" name="lname" size=25/>
<br><br>Street/Box Address:
<input type="text" name="addr" size=35/>
Apt/Unit #:
<input type="text" name="unit" size=4/>
<br><br>City/Providence:
<input type="text" name="ctyname" size=35/>
State:
<input type="text" name="stname" size=2/>
Zip:
<input type="text" name="zip" size=6/><br><br>
Country:
<input type="text" name="country" size=25/>
<p><input type=submit name="submit" value="Submit"><input type="reset" name="Reset" value="Reset">
====================Here is the php file=================
<?
$ID_address=$_POST['id_address'];
$ID=$_POST['ID'];
$company=$_POST['company'];
$fname=$_POST['fname'];
$lname=$_POST['lname'];
$addr=$_POST['addr'];
$unit=$_POST['unit'];
$ctyname=$_POST['ctyname'];
$email=$_POST['email'];
$stname=$_POST['stname'];
$zip=$_POST['zip'];
$country=$_POST['country'];
$conn=mysql_connect("mysql", "userid", "password") or die(mysql_error());
mysql_select_db("thespianprada",$conn) or die(mysql_error());
mysql_query("INSERT INTO 'contacts' VALUES ('$id_address','$ID','$company','$fname', '$lname','$addr','$unit','$ctyname','$email', '$stname','$zip','country')");
Print "Your information has been successfully added to the database.";
?>
I'm sure what I can't insert in the table. Is there something wrong with the syntax for the INSERT command? I followed some tutorials and still get no results. Any assistance will be apreciated.