Jump to content

[SOLVED] <? if (you answer){ you're PHP MASter;} else { you're not;} ?>


TheFilmGod

Recommended Posts

I have a registration processing form.

 

It goes through all the checking and if an eror occurs it make $error1 or $error2 or... $error7 = true;

 

How can I create an if statement like so:

 

if ( any of $error1, $eror2, $error3, $error4, $error5, $error6, $error7 are true) {

 

  do this;

 

}

 

? ???

Link to comment
Share on other sites

Well, given what you've done so far, you're only real option is:

 

<?php
if(isset($error1) || isset($error2)|| ...){
//errors
}
?>

 

However, your code would be neater and more maintainable if you were to stick your errors into an an array. You could then check the number of elements in the array to see if there are any errors.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.