Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.77 KB | None | 0 0
  1. <html>
  2. <body>
  3.  
  4. <form action="handle_reg.php" action="POST">
  5.  
  6.  First Name: <input type="text" name="first_name" size="20" /><br />
  7.  Last Name: <input type="text" name="last_name" size="20" /><br />
  8.  Email Address: <input type="text" name="email" size="20" /><br />
  9.  Password: <input type="password" name="password" size="20" /><br />
  10.  Confirm Password: <input type="password" name="confirm" size="20" /><br />
  11.  
  12.  <p>Date Of Birth:
  13.     <select name="month">
  14.         <option value="">Month</option>
  15.         <option value="1">January</option>
  16.     </select>
  17.  
  18.     <select name="day">
  19.         <option value="">Day</option>
  20.         <option value="1">1</option>
  21.     </select>
  22.  
  23.     <input type="text" name="year" value="YYYY" size="4" />
  24. </p>
  25.  
  26. <p>Favorite color:
  27.     <select name="color">
  28.         <option value="">Pick One</option>
  29.         <option value="green">Green</option>
  30.     </select>
  31. </p>
  32.  
  33. <p><input type="submit" name="submit" value="Register" /></p>
  34.  
  35.  
  36. </form>
  37.  
  38. </body>
  39. </html>
  40.  
  41.  
  42. // PHP CODE BELOW BUT ON A SEPERATE .PHP FILE ON MY MACHINE
  43.  
  44. <?php
  45.  
  46. //error checking
  47. ini_set("display_errors", 1);
  48. error_reporting(E_ALL & ~ E_NOTICE);
  49.  
  50. //if register_globals is off or 0
  51. $first_name = $_POST["first_name"];
  52. $last_name  = $_POST["last_name"];
  53. $email      = $_POST["email"];
  54. $password   = $_POST["password"];
  55. $confirm    = $_POST["confirm"];
  56. $month      = $_POST["month"];
  57. $day        = $_POST["day"];
  58. $year       = $_POST["year"];
  59. $color      = $_POST["color"];
  60.  
  61. print "<p>Registration Page</p>";
  62.  
  63. //running checks
  64. if(empty($first_name)){
  65.     print "<p>Please enter your first name</p>";
  66. }
  67. if(empty($last_name)){
  68.     print "<p>Please enter your last name</p>";
  69. }
  70. if(empty($email)){
  71.     print "<p>Please enter your email address</p>";
  72. }
  73. if(empty($password)){
  74.     print "<p>Please enter your password</p>";
  75. }
  76.    
  77.  
  78. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement