php complex form

Codes here !

Moderators: macek, egami, gesf

Post Reply
User avatar
egami
php-forum GURU
php-forum GURU
Posts: 2192
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: php complex form

Post by egami » Tue Apr 16, 2013 1:34 pm

Make an $array of all of the key data you want to verify.

then..

Code: Select all

foreach($array as $k => $v) {
  $outarray = array();
  if (!isset($_POST[$k]) || $_POST[$k] != '') { 
    $outarray[$k] = "$k was not set or invalid.";
  }
}

if (count($outarray > 1)) { 
  foreach($outarray as $k => $v) { 
    echo "<p>$v</p>";
  }
  die("Sorry, there's an error in your script.");
}
 

seandisanti
php-forum Fan User
php-forum Fan User
Posts: 973
Joined: Mon Oct 01, 2012 12:32 pm

Re: php complex form

Post by seandisanti » Wed Apr 17, 2013 3:05 pm

phpacademy.org has a couple of videos on simple form validation also. https://phpacademy.org/course/php-easy- ... n-tutorial

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests