PHP/MySQL: Cannot insert my data in database :c?

Reann

New member
//this is the html form

<html>
</html><html>
<title>Register</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="hidden.css" rel="stylesheet" type="text/css">

<head>


<div id="upperSkin"><img src="brown.jpg"></div>

</head>
<center>
<form method= "post" action= "insertRegisteredUser.php">
<table bgcolor="lightgreen" align="left" width="40%" height="100">
<tr><td><table align="center">
<tr><td><b>Register</td>
<tr><td>Username</td><td><input type="text" size=30 name="username"></td>
<tr><td>Firstname</td><td><input type="text" size=30 name="firstname"></td>
<tr><td>Surname</td><td><input type="text" size=30 name="surname"></td>
<tr><td>Middlename</td><td><input type="text" size=30 name="middlename"></td>
<Tr><td>Password</td><td><input type="password" size=30 name="password"></td>
<tr><td>Address</td><td><input type="text" size=30 name="address"></td>
<tr><td>Contact Number</td><td><input type="text" size=20 name="contactNumber"></td>
<tr><td>E-mail address</td><td><input type="text" size=50 name="emailAd"></td>
<tr><Td></td><td><input type="submit" ><input type="reset" name="reset" value="Reset">
</table>
</table>
</form>
</center>




<body>
</body>
<div id="locFooter">
<p><center><br><br>Privacy Policy<br>BloomScent<br>Copyright © 1997-2000<br>Hosted by Googles</p>
<!-- end .footer --></div>





</html>


//this is the insertRegisteredUser.php

<?php
$userName='root';
$Password='';
$database='db_orders';


$username=$_POST['username'];
$firstname=$_POST['firstname'];
$surname=$_POST['surname'];
$middlename=$_POST['middleName'];
$password=$_POST['password'];
$address=$_POST['address'];
$contactNum=$_POST['contactNum'];
$email=$_POST['emailAd'];


$con=mysql_connect(localhost,$userName,$Password);


@mysql_select_db($database,$con) or die( "Unable to select database");

$query = "INSERT INTO tb_user(userName, firstName, surname, middleName, password, address, contactNum,email) VALUES('$username','$firstname','$surname','$middlename','$password','$address','$contactNum','$email)";


mysql_query($query);

mysql_close();
?>


//What's the problem here? when I open the table on MySQL table, its still tells me that its empty even though I already answered the form.? Im using xampp.
 
Back
Top