Advertisement
Guest User

Untitled

a guest
Jun 29th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <style>
  5. .error {
  6. color: red;
  7. }
  8. </style>
  9. <title>Register</title>
  10. </head>
  11. <body>
  12. <form action="#" method="POST">
  13. <h1 id="Signup">Sign Up</h1>
  14. <input type="text" name="Username" placeholder="Please Enter a Username">
  15. <span class="error"><? echo $errorusername;?></span>
  16. <br>
  17. <input type="password" name="Password" placeholder="Please Enter a Password">
  18. <span class="error"><? echo $errorpass;?></span>
  19. <br>
  20. <input type="Submit" id ="Submit">
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27. </form>
  28. </body>
  29. </html>
  30.  
  31. <?
  32.  
  33. $errorpass = "";
  34. $errorusername ="";
  35.  
  36. if(isset($_POST['Submit'])) {
  37. if(empty($_POST['Username'])) {
  38. $errorusername = "name is required";
  39. } else {
  40. $Username = $_POST['Username'];
  41.  
  42. if (!preg_match("/^[a-zA-Z ]*$/", $Username)) {
  43. $errorusername ="Only numbers allowed";
  44. }
  45. }
  46. if(empty($_POST['password'])) {
  47. $errorusername = " A password is required";
  48. } else {
  49. $password = $_POST['password'];
  50.  
  51. if (!preg_match("/^[a-zA-Z ]*$/", $password)) {
  52. $errorpass = "Need to contain numbers and symbols";
  53.  
  54. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement