H
H
Guest
Hi, I am a PHP newbie, and I just wanted to know how I would be able to make an IF statement that needed this:
if $subject has nothing selected from a drop down list (by that I mean the first value in the list, which is blank), I want it to print "Problem"
OR
if $subject has 'Other' selected AND $other has nothing written in it, I want it to print"Problem".
Here is part of my code, showing what I have tried
if ($subject = "" OR (($subject = "Other") AND empty ($other))) {
echo 'Problem';
}
However, when I run it, it seems that it only prints 'Problem' when nothing is written in $other, regardless of what is selected from the drop down list.
Thanks in advance
P.S sorry if this is all complicated - I found it hard to explain!
if $subject has nothing selected from a drop down list (by that I mean the first value in the list, which is blank), I want it to print "Problem"
OR
if $subject has 'Other' selected AND $other has nothing written in it, I want it to print"Problem".
Here is part of my code, showing what I have tried
if ($subject = "" OR (($subject = "Other") AND empty ($other))) {
echo 'Problem';
}
However, when I run it, it seems that it only prints 'Problem' when nothing is written in $other, regardless of what is selected from the drop down list.
Thanks in advance
P.S sorry if this is all complicated - I found it hard to explain!