i'm trying to make the sign in and the sign up within the same page in a website i have this form in html
<form name="form1" action="check_login.php" method="post">
<input type="email" id= "email" name="email" required="required" placeholder="Email Address" />
<input type="password" id= "password" name="password" required="required" placeholder="Password"/>
<span><input type="checkbox" class="checkbox">Keep me signed in</span>
<button name="login" type="submit" class="btn btn-default">Login</button>
</form>
and the form
<form name="form2" action="check_login.php" method="post">
<input type="text" id= "fname" name="fname" required="required" placeholder="First Name"/>
<input type="text" id= "mname" name="mname" required="required" placeholder="Middle Name"/>
<input type="text" id= "lname" name="lname" required="required"placeholder="Last Name"/>
<input type="email" id= "email" name="nemail"required="required" placeholder="Email "/>
<input type="password" id= "password" name="npassword"required="required" placeholder="Password"/>
<input type="password" id= "cpassword" name="cpassword"required="required"placeholder="Confirm Password"/>
<select name='gender' class='col-sm-4'>
<option value='male'>male</option>
<option value='female'>female</option>
</select>
<div class='col-sm-offset-8'>
<button name="sign_up" type="submit" class="btn btn-default">Sign up</button> </div>
</form>
they are in the same page and both navigate to other page within my website then i have this code in php
if (!empty($_POST['login']))
{
$email = $_POST['email'];
$password = $_POST['password'];
$sql_stmt="select email, password from users where email = '"
.$email."' and password ='".$password."'";
$result= mysqli_query($connection,$sql_stmt);
if ($result)
{
header ("location: index.php");
}
else {
header ("location: login.php");
}
}
if(!empty($_POST['sign_up']))
{
$fname=$_POST['fname'];
$mname=$_POST['mname'];
$lname=$_POST['lname'];
$gender=$_POST['gender'];
$nemail=$_POST['nemail'];
$npassword=$_POST['npassword'];
//if email is already stored ?
$signup="INSERT INTO `users`(`first_name`, `middle_name`, `last_name`,"
. " `gender`, `email`, `password`)"
. " VALUES ('".$fname."','".$mname."','".$lname."','".$gender.
"','".$nemail."','".$npassword."')";
$result1= mysqli_query($connection, $signup);
if ($result1)
{
header ("location: index.php");
}
else {
header ("location: login.php");
}
}
but the navigation to the index never happen!