Pete Winter
asked on
show region if
How do I say. Only show region if $row_WAATKroi['printer'] equals 1 or 2?
ASKER
Thanks for the reply, but it's not working. Can you please check my code:
<?php if ($row_WAATKroi['printer'] ===1 || $row_WAATKroi['printer'] ===2) { // Begin Show Region ?>
<li class="t3"><a href="#p7EPMc1_3" id="p7EPMtrg1_3">Rental</a ></li>
<?php } // End Show Region ?>
<?php if ($row_WAATKroi['printer'] ===1 || $row_WAATKroi['printer'] ===2) { // Begin Show Region ?>
<li class="t3"><a href="#p7EPMc1_3" id="p7EPMtrg1_3">Rental</a
<?php } // End Show Region ?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect. Thanks Ray
try this..
<?php if ($row_WAATKroi['printer'] ==1 || $row_WAATKroi['printer'] ==2)
// Begin Show Region
echo '<li class="t3"><a href="#p7EPMc1_3" id="p7EPMtrg1_3">Rental</a ></li>';
// End Show Region
?>
notice I did two things. 1) rather than breaking out of php I used the echo to write the html to screen and 2 based on the if statement description at w3schools I took the curly brackets out (as was in my original example).
http://www.w3schools.com/php/php_if_else.asp
<?php if ($row_WAATKroi['printer'] ==1 || $row_WAATKroi['printer'] ==2)
// Begin Show Region
echo '<li class="t3"><a href="#p7EPMc1_3" id="p7EPMtrg1_3">Rental</a
// End Show Region
?>
notice I did two things. 1) rather than breaking out of php I used the echo to write the html to screen and 2 based on the if statement description at w3schools I took the curly brackets out (as was in my original example).
http://www.w3schools.com/php/php_if_else.asp
oh and the reason I had three equals (===) is because it makes a strick comparison...
Thanks for the points. Almost without exception the form data contains character strings instead of numeric values. So, for example, a numeric (integer) value 3 is not considered the same as a character string "3" if you use the === operator. However due to PHP type juggling, the number and character string are considered the same if you use the == operator.
Best regards, ~Ray
Best regards, ~Ray
//show region code here
;