php complex form

Codes here !

Moderators: macek, egami, gesf

enoch
New php-forum User
New php-forum User
Posts: 2
Joined: Fri Apr 12, 2013 11:36 am

php complex form

Postby enoch » Fri Apr 12, 2013 12:21 pm

Hi! I should validate and then save this data to the database.. how can I do? Thanks!
http://wellnature.it/demostudio/form.html

enoch
New php-forum User
New php-forum User
Posts: 2
Joined: Fri Apr 12, 2013 11:36 am

Re: php complex form

Postby enoch » Sat Apr 13, 2013 3:51 am

help me please :(

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

Re: php complex form

Postby 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: 838
Joined: Mon Oct 01, 2012 12:32 pm

Re: php complex form

Postby 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


Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 1 guest

cron