Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. ob_start();
  4. $output = '';
  5.  
  6. if(isset($_POST['submit']))
  7. {
  8.  
  9. $error = array('fName' => false);
  10.  
  11. $_POST['fName'] = isset($_POST['fName']) ? trim($_POST['fName']) : ""; // data initialization and sanitization
  12. // ...
  13. // ...
  14.  
  15.  
  16. if($_POST['fName'] == '') // error checking
  17. $error['fName'] = true;
  18. // ...
  19. // ...
  20.  
  21.  
  22. // behavior
  23. if($error['fName'])
  24. $output = array('code' => 1, 'msg' => 'There was an error with your input. Please go back and enter all the details.');
  25. else
  26. $output = array('code' => 2, 'msg' => 'Email Sent');
  27. }
  28.  
  29. echo json_encode($output);
  30.  
  31. $printscreen = ob_get_clean();
  32. file_put_contents("printscreen.txt", $printscreen);
  33. echo $printscreen;
  34.  
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement