Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When i fill out my form and submit it it says submitted successfully however when i look in my MySQL database there is not record added. What have i done wrong.

This is my inserting php code:
PHP
<?
 $name=$_POST['name'];
 $time = date('l jS \of F Y h:i:s A');
 $email=$_POST['email'];
 $location=$_POST['location'];
 $sex=$_POST['sex'];
 mysql_connect("quollcraft.net", "quollcr1_forum", "PASSWORD") or die(mysql_error());
 mysql_select_db("quollcr1_hub") or die(mysql_error());
 mysql_query("INSERT INTO `data` VALUES ('$Username', '$name', '$email', '$location', '$sex'. '$time')");
 Print "Your information has been successfully added to the database.";
 ?>

This is my form:
XML
<form action="process.php" method="post">
About: <input type="text" name="name"><br>
Location: <input type="text" name = "email"><br>
Interests: <input type="text" name = "location"><br>
Gender: <input type="text" name = "sex"><br>
 <input type="submit" value="Submit">
 </form>
Posted
Comments
Peter Leow 16-Jul-14 9:17am    
This '$Username' in the sql query statement came from no where?
Member 10943738 16-Jul-14 16:58pm    
The $Username variabe is set in a different section of my PHP code

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900