If statement with any number of or's

I have an if statement and I need to check if any of the values are present and if so display it as below:


<? if ($data['Rottcause2']="Asphyxia") or ($data['Rottcause2']="Poison") { ?>
<div id ="f1">
<select name="rottcause" id="opts" onchange="showForm()" >
<option value = "0">Select Option</option>
<option value = "Asphyxia">Asphyxia</option>
<option value = "Poison">Poison</option>
<option value = "Drowning">Drowning</option>
</select>
</div>
<? } else { ?>
nope
<? } ?>

Need some help on the if or bit below as its not working


<? if ($data['Rottcause2']="Asphyxia") or ($data['Rottcause2']="Poison") { ?>

Your syntax is incorrect.
It should be written like this


<? if ($data['Rottcause2']=="Asphyxia") || ($data['Rottcause2']=="Poison") { ?>

In PHP (like many languages) the single equals (=) is an assignment operator and the double equals (==) is the comparison operator.
Secondly, the OR operator is a double pipe (||).

Hope this helps.

Ah yes, thank you ParkinT

E X C E L L E N T

Problem solved.
Thread closed.