Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. # In create_user.php
  2. * Create two methods, one to validate the input and one to actually persist into the DB
  3. * Write both methods so that they accept a parameter instead of pulling from $_POST
  4.  
  5. * Have the validate method return an associative array of field => error. So like:
  6.  
  7. function validate($params){
  8. // stuff here
  9.  
  10. return ["password" => "too short", "username" => "in use"];
  11. }
  12.  
  13. # In index.php
  14. * Call validate, and if there are errors stick them above the field with some Bootstrap errors ;)
  15. * Put the original values of the form in if there's an error
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement