Problem PHP script


/ Published in: PHP
Save to your folder(s)

Trying to resolve without Global Variables.


Copy this code and paste it in your HTML
  1. <?php
  2. $validation = array();
  3.  
  4. if (!$_POST['email']) {
  5. array_push ('email', $validaton);
  6. }
  7.  
  8. if (!$_POST['phone']) {
  9. array_push ('phone', $validaton);
  10. }
  11. ?>
  12.  
  13. <body>
  14. <?php if(in_array('email', $validation)): ?><span class="error"><?php echo 'Please enter an email address'; ?></span><?php endif; ?>
  15. </body>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.