Good Morning, I am trying to create a login page for my website but whenever I add my php script to the page nothing shows up when I go to the site. When I remove the php I can see the form when I visit the page.
Here is the code:
Any help would be greatly appreciated.
<!doctype html>
<html>
<head>
<title>Login Page</title>
</head>
<body>
<form method="post" action="">
Email<br><input type="email" name="email"><br>
Password<br><input type="password" name="pass"><br>
<input type="submit" value="login" name="login" />
</form>
<?php
$con= mysqli_connect("localhost", "user", "passwordexample" "exampledatabase");
if(isset($_POST['login'])){
$email= mysqli_real_escape_string($con, $_POST['email']);
$password= mysqli_real_escape_string($con, $_POST['pass']);
$select_user="SELECT * FROM users WHERE Email='$email' AND Passwords='$password'";
$run_user=mysqli_query($con, $select_user);
$check_user= mysqli_num_rows($run_user);
if($check_user > 0){
header('location:form.php');
} else{
echo "wrong username or password";
}
}
?>