My code:
<?PHP
session_start();
$user = 'root';
$password = 'root';
$db = 'Authentication';
$host = 'localhost';
$port = 3306;
$link = mysqli_init();
$success = mysqli_real_connect(
$link,
$host,
$user,
$password,
$db,
$port
);
if(isset($_POST['sbtn'])){
session_start();
$f_name = mysqli_real_escape_string($_POST['f_name']);
$l_name = mysqli_real_escape_string($_POST['l_name']);
$email = mysqli_real_escape_string($_POST['email']);
$pass = mysqli_real_escape_string($_POST['pass']);
$c_pass = mysqli_real_escape_string($_POST['c_pass']);
if($pass == $c_pass){
//create user
$Password = md5($pass);
mysqli_query($success, $db);
$query = "INSERT INTO users( email, password, f_name, l_name) VALUES ($email, $pass, $f_name, $l_name)";
mysqli_query($success, $query);
}else{
//tell user they are not equal
echo("The two passwords did not match");
}
}
mysqli_close($success);
?>
It seems to be that all of the rest of the code works as I have error checked the code and I am new to coding in php therefor I am struggling to understand how i am able to overcome this problem!
Help would be much appreciated!