Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. <?php
  2. $errors = [];
  3.  
  4. if(!array_key_exists('user_name', $_POST) || $_POST['user_name'] == ''){
  5. $errors['user_name'] = "il manque votre nom";
  6. }
  7. if(!array_key_exists('user_email', $_POST) || $_POST['user_email'] == '' || !filter_var($_POST['user_email'], FILTER_VALIDATE_EMAIL)){
  8. $errors['user_email'] = "il manque votre email";
  9. }
  10. if(!array_key_exists('user_message', $_POST) || $_POST['user_message'] == ''){
  11. $errors['user_message'] = "il manque votre message";
  12. }
  13. if(!array_key_exists('user_tel', $_POST) || $_POST['user_tel'] == ''){
  14. $errors['user_tel'] = "il manque votre tel";
  15. }
  16. if(!array_key_exists('user_select', $_POST) || $_POST['user_select'] == ''){
  17. $errors['user_select'] = "il manque votre selection";
  18. }
  19. if(!empty($errors)){
  20. session_start();
  21. $_SESSION['errors'] = $errors;
  22. $_SESSION['inputs'] = $_POST;
  23. //echo "<pre>"; var_dump($_POST);echo "<pre>";die();
  24. header('location: form.php');
  25. }
  26.  
  27. var_dump($errors);
  28. die();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement