0

So i'm trying to make a proper login screen so when you click on the mysite i presents you with the log in screen, and after you logged in it presents you the actual page. the normal code goes below this

<form action="hello.html" method="POST">
     <input type="text" placeholder="username" name="username"><br />
     <input type="password" placeholder="password" name="password"><br />
     <input type="submit" name="submit" value="Connect" />
</form>

<?php 

if(isset($_POST['submit'])){    //when user click connect
     if(!empty($_POST['username']) && !empty($_POST['password'])){ 
         if ($_POST['username']=="guest" && $_POST['password']=="pwrd"){
             header("Location:home.php");
         } else {
             echo "check the password and username";
         }
     } else {
         echo "fill all the inputs";
     }
} 14:50 09/10/2016
Mosh Feu
  • 26,720
  • 15
  • 83
  • 122
Lukas.S
  • 41
  • 6

1 Answers1

0

Change this <form action="hello.html" method="POST"> to

<form action="hello.php" method="POST">. And Save your script file to .php.

Funk Forty Niner
  • 74,372
  • 15
  • 66
  • 132
Aina
  • 30
  • 1
  • 3
  • so one more question. when I log in with the wrong username or password it just returns to the normal page.(it dose the same when the details are correct) – Lukas.S Oct 10 '16 at 10:08