Guest User

Untitled

a guest
Oct 20th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. <?php
  2.  
  3. $form = new Form( new Validator );
  4.  
  5. $form->add_field(
  6. 'Name',
  7. array(
  8. 'required' => 'Full Name is required'
  9. )
  10. );
  11. $form->add_field( 'Address1' );
  12. $form->add_field( 'Address2' );
  13. $form->add_field( 'City' );
  14. $form->add_field( 'State' );
  15. $form->add_field( 'ZipCode' );
  16. $form->add_field(
  17. 'Email' ,
  18. array(
  19. 'required' => 'Email Address is required',
  20. 'email' => 'A valid email address is required'
  21. )
  22. );
  23. $form->add_field( 'Phone');
  24. $form->add_field(
  25. 'Interest' ,
  26. array(
  27. 'required' => 'You must select an Area of Interest'
  28. )
  29. );
  30. $form->add_field( 'Comments' );
  31.  
  32. $mail = new Mailer( $form );
  33.  
  34.  
  35. /*
  36. * Rendering the page
  37. */
  38.  
  39. $page = new Template();
  40. $page->use_file( 'contact.php' );
  41.  
  42. if ( isset( $_POST['Submit']))
  43. {
  44. $form->collect();
  45. if( $form->is_valid() )
  46. {
  47. $page->use_file( 'done.html' );
  48. $mail->send();
  49. }
  50. else
  51. {
  52. $form->populate( $page );
  53. }
  54. }
  55.  
  56.  
  57. echo $page->render();
  58.  
  59. ?>
Add Comment
Please, Sign In to add comment