Small if statement used with images
Posted: Sun May 17, 2009 3:21 pm
Is there some reason why this is if statement is not working?
Here is the url I am using http://dev/categories.php?catid=2
For some reason the image that displays is art.jpg no matter what # I use in the URL.
Here is the url I am using http://dev/categories.php?catid=2
For some reason the image that displays is art.jpg no matter what # I use in the URL.
Code: Select all
<img src="images/categories/<?php
$cat = intval($_GET['catid']);
if ($cat = '1') {
echo "art.jpg";
} elseif ($cat = '2') {
echo "art2.jpg";
} elseif ($cat = '3') {
echo "art3.jpg";
} else {
echo "na.jpg";
}
?>"/>