i have created a simple signup and login form. The signup form is successfull. i have fetch the mail and password from database using php and mysql. Can anyone help me to solve the problem?.
Login Form:
<?php
include('connect.php');
$mail=$_POST['mail'];
$password=$_POST['password'];
$sql=mysql_query("SELECT count(*) FROM user WHERE mail='$mail' and password='$password'")
or die(mysql_error());
$result=mysql_fetch_array($sql);
if ($result>0) {
$_SESSION["mail"]=$mail;
$_SESSION["password"]=$password;
session_write_close();
header('Location:dash.php');
}
else{
echo"Failed to login !";
}
?>
<form method="POST">
<input type="email" name="mail" placeholder="E-mail" class="form- control" style="color:red;"><br><br>
<input type="password" name="password" placeholder="Enter Password" class="form-control"><br><br>
<button class="btn btn-lg btn-danger col-md-offset-5">LogIn</button><br><br>
</form>