i have the following if-clause:
if(empty($var)){
$errors[]="Failure";
}
this is for a form that will be display an errormessage when a user has made no entries. i would like to hide this field when a user has made something specific so that he cant see this input field. this div will only being displayed when another variable is set. because of the “empty” problem i got the errormessage even when there is no inputfield. so my question is:
how can i add further terms to that clause that it will be like:
if(empty($var) only when $var2===true ){
$errors[]="Failure";
}
i already tried to use && but this doesn’t work the correct way. thats why i’m asking and thought maybe there is another way. thanks to all.
Try:
If $var is empty and $var2 is TRUE it will be inside the if condition. did you mean something like that