I am using Post method in my website. In my index.html file is the following code:
<!DOCTYPE html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>Heater Login</title> <link rel="stylesheet" href="css/style.css"> </head> <body> <form method="post" action="login.php" class="login"> <p> <label for="login">Username:</label> <input type="text" name="login" id="login" value="John Appleseed"> </p> <p> <label for="password">Password:</label> <input type="password" name="password" id="password" value="4815162342"> </p> <p class="login-submit"> <button type="submit" class="login-button">Login</button> </p> </form> </body> </html>
And in my login.php file is the following code:
<?php echo($_POST['login']); echo($_POST['password']); ?>
When I open html file, enter my credentials, click submit button it goes to php file end there’s nothing.
Advertisement
Answer
Can you change this line of code with the new one Hope it will work
<button type="submit" class="login-button">Login</button> <input type="submit" name="submit" value="Login">
And last I want that you copy whole code from the stackoverflow and use this code.Some times space may create a problem.