Advertisement
Guest User

Untitled

a guest
Jul 7th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.51 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. class RegisterForm
  5. {
  6.     protected $action;
  7.     protected $method;
  8.     protected $username;
  9.     protected $password;
  10.     protected $confirm_password;
  11.    
  12.     /**
  13.      * Form is constructed and given an action and a method
  14.     */
  15.     public function __construct($action, $method)
  16.     {
  17.    
  18.     }
  19.    
  20.     /*
  21.      * Form is populated so that if it is render()'d it will already contain the field data
  22.       * Expected fields: username (the name of the user) password (the password) confirm_password(the confirmation of the password)
  23.      */
  24.     public function populate($post)
  25.     {
  26.         mysql_real_escape_string($post);
  27.     }
  28.    
  29.     /**
  30.      *  If the form is valid, return true
  31.      *  If not, return false.
  32.      *  A valid form contains a username and a password, and both password and confirm_password must be identical
  33.      */
  34.     public function isValid()
  35.     {
  36.        
  37.     }
  38.    
  39.     /**
  40.      * Return the full HTML code for a valid form; If the form has been populated the fields must contain the correct data
  41.      */
  42.     public function render()
  43.     {
  44.         $html = <<<END 
  45.        
  46.         <html>
  47.         <form action = $this->action method = $this->method >
  48.        
  49.        
  50.         First Name: <input type = 'text' name = 'fName'>
  51.         <br />
  52.         Surname: <input type = 'text' name = 'sName'>
  53.         <br />
  54.         Username: <input type = 'text' name = 'uName'>
  55.         <br />
  56.         Password: <input type = 'password' name = 'pWord'>
  57.         <br />
  58.         E-mail: <input type = 'text' name = 'eMail'>
  59.         <br />
  60.         //Submit button.
  61.         <input type = 'submit' name = 'submit' value = 'Register'>
  62.        
  63.        
  64.         </form>
  65.         </html>
  66.        
  67. END;
  68.         return $html;
  69.     }
  70. }
  71.  
  72.  
  73. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement