Jump to content

Archived

This topic is now archived and is closed to further replies.

trippin13

isset issues

Recommended Posts

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 ??

Share this post


Link to post
Share on other sites
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.

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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.