0

please before you mark this question as duplicate make sure it is the same question, because i have search allover stackoverflow for this question but all the answer i saw none of them worked for me,

i am trying to build a 2 step login form like that of gmail

so that on the first step the user will input his or her email address then on the second step the email address will display at the top of the form, then under, he will be asked to input his password

<!DOCTYPE html>
<html lang="en" >
<head>
  <meta charset="UTF-8">
  <title>2 step login</title>
  <link rel="stylesheet" href="css/style.css">
</head>
<body>
  <div class="container-login">
    <div class="avatar-user">
      <span class="avatar-anonymous avatar-visible"></span>    
      <img src="eu.png" alt="" class="avatar-img "/>
    </div>

    <div class="data-user-find">
      <p class="user-email"><?php echo "$email" ;?></p>
    </div>

    <form action="" class="form-login">
      <div class="step-login step-one">
        <input name="email" type="email" class="input-text"/>
        <input type="button" class="btn next-step" value="Next">
      </div> 

      <div class="step-login step-two">
        <input type="text" class="input-text"/>
        <input type="submit" class="btn" value="Login">
      </div>
    </form>

    <script  src="js/index.js"></script>    
    <?php $email = $_POST["email"]; ?>
</body>
</html>

i tried this it did not work, i keep reciving an error message

(Undefined index: email in C:\xampp\htdocs\2step\index.php on line 54

please someone should help me

treyBake
  • 6,440
  • 6
  • 26
  • 57
Britchi2
  • 37
  • 1
  • 7

2 Answers2

0

This should help:

if(isset($_POST['email']){
   $email = $_POST['email'];
}
The Law
  • 344
  • 3
  • 20
0
 <input name="email" type="email" class="input-text"/>
      <input type="button" class="btn next-step" value="Next">
    </div>

This is not 'submit' button, are you sure your values reach the PHP code on first button click?

Try:

 <input name="email" type="email" class="input-text"/>
      <input type="submit" class="btn next-step" value="Next">
    </div>
Div
  • 63
  • 2
  • 10