Jump to content


Photo

isset issues


  • Please log in to reply
1 reply to this topic

#1 trippin13

trippin13
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 09 March 2006 - 11:59 PM

Hi I have a form with over 200 fields .... is there a way to automate or skip the

ISSET() to avoid getting undefined variables??? there is too many to write
there must be a better way ????

please help ??

#2 Flinch

Flinch
  • Members
  • PipPip
  • Member
  • 13 posts
  • Locationcomputer, house, USA

Posted 10 March 2006 - 12:07 AM

Depends on what kinds of fields they are, but if they're simple fields like text inputs, I would name the fields like "input1", "input2", "input3" and so. The, us for() to loop through every field and validate it.

for($i=1; $i <= 200; $i++) {
  //validation code here
   $field = "input".$i;
  if(! isset($_POST[$field]) ) {
     //empty!
   }
}

[br][br][br][br]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users