Topic outline


    • In this session, we are going to create a  very simple login page in php, username and password entered in login page we will get posted in another page.

      Now we will see how to create a simple Login page in WAMP Server

      1) Create a folder name sampleloginwithoutdatabase in c:/xampp/htdocs/sample as shown below.

      2) We are going create two file in the above folder, one is a login page in html and other one is getdata page in php.

      Code for Login page in html

      <html>

       <head> 

       <title>SIMPLE LOGIN FORM IN PHP WITHOUT DATABASE</title> 

       </head>

       <body> 

       <form action = "getdata.php" method = "POST"> 

      USER NAME <input type = "text" name = "username"> <br><br> 

        PASSWORD <input type = "text" name = "password"> <br><br> 

        

      <input type = "Submit" name = "insert" value = "Save"> 

      <input type = "Reset" value = "Cancel"> 

      </form> 

      </body> 

      </html>

      3) The following code help us to transfer username and password entered in the login page to other page

      <html> 

      <head> <title>get data from LOGIN page</title> 

      </head> 

      <body> 

         <?php        

        echo "username:" .$_POST["username"]."</br>"; 

        echo "password:".$_POST["password"]."</br>";  

                   ?> 

       </body> 

      </html>

      The following will be the output of the above simple login page we created in PHP


      After clicking the save button username and password entered in our login page, we will see it in next page as shown below