I create a simple code for user registration, and when user submit the data was not recorded to MySQL.
Here is my logic code
<?php
$username = $_POST["user"];
$password = $_POST["pass"];
$confirmPassword = $_POST["repass"];
$email = $_POST["email"];
$username = stripcslashes($username);
$password = stripcslashes($password);
$confirmPassword = stripcslashes($confirmPassword);
$email = stripcslashes($email);
$con = mysqli_connect('localhost', 'root', '', 'dbtest');
if($con->connect_error)
{
echo"<script type='text/javascript'>alert('connection to database failed!')</script>";
}
else
{
$query = mysqli_query($con, "INSERT INTO 'user'('Username', 'Password', 'Email') VALUES('$username', $password', '$email')");
echo "You are successfully registered!";
}
$con->close();
?>
Is there something that I missed?