1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

PHP Login Script


3 of 7

Registration Page 2


 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">

 <table border="0">


 <input type="text" name="username" maxlength="60">



 <input type="password" name="pass" maxlength="10">


 <tr><td>Confirm Password:</td><td>

 <input type="password" name="pass2" maxlength="10">


 <tr><th colspan=2><input type="submit" name="submit" 
value="Register"></th></tr> </table>




The full code can be found on GitHub: https://github.com/Goatella/Simple-PHP-Login

If the form has not been submitted, they are shown the registration form, which collects the username and password.Basically what this does is check to see if the form has been submitted. If it has been submitted it checks to make sure that the data is all OK (passwords match, username isn't in use) as documented in the code. If everything is OK it adds the user to the database, if not it returns the appropriate error.

Related Video
Basic PHP Syntax
Using PHP With HTML
  1. About.com
  2. Technology
  3. PHP / MySQL
  4. Step By Steps
  5. How to create a members area in PHP

©2014 About.com. All rights reserved.