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
https://forums.phpfreaks.com/topic/67687-solved/
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
https://forums.phpfreaks.com/topic/67687-solved/#findComment-340019
Share on other sites

Archived

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

×
×
  • 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.