I've created a registration form using html and css and now I want to submit the data entered by the user into mysql database.
HTML Form Code:
<form method="post" name="newuser_frm" onSubmit= "return validate();" action="reg.php"> </p>
<p>
first name*:<br><input type="text" name="firstname">
last name*:<br> <input type="text" name="lastname">
<br>
new username*:<br><input type="text" name="newusername">
<br>
new password*:<br><input type="password" name="newpassword">
<br>
Email*:<br><input type="email" name="email">
<br><br>
Sex*:<br>
<input type="radio" name="sex" value="male">Male
<input type="radio" name="sex" value="female">female
<br><br>
<input type="submit" value="REGISTER">
<br><br>
(*)All fields are mandatory</p>
</form>
PHP Code:
<?php
include"config.php";
$firstname=$_POST['firstname'];
$lastname=$_POST['lastname'];
$username=$_POST['newusername'];
$password=$_POST['newpassword'];
$email=$_POST['email'];
$query="INSERT into user (username,password,firstname,lastname,email) VALUES('$username','$password','$firstname','$lastname','$email')";
mysql_query($query);
?>
I have no errors but also no records on the database, and I didn't see any errors. Could you help me detect the error or find the problem?