Issue with my Simple If statment
Posted: Mon Oct 17, 2011 12:45 pm
I have this simple piece of code.
I am using GET[] to retrieve the catID from URL, then match it and set a backgorund image, some backgorund images can change per catID variable. When selected or clicked on.
It is not working, it is producing the catId in ech $_Get[], but not matching it with $filename to set correct Image.
Ex. Browser catID may == 1, it code displays catid = 1, file name = deals_2.jpg.
This is worng. should be catid = 1 , filename = 1.
PLEASE HELP, missing something.
I am using GET[] to retrieve the catID from URL, then match it and set a backgorund image, some backgorund images can change per catID variable. When selected or clicked on.
It is not working, it is producing the catId in ech $_Get[], but not matching it with $filename to set correct Image.
Ex. Browser catID may == 1, it code displays catid = 1, file name = deals_2.jpg.
This is worng. should be catid = 1 , filename = 1.
PLEASE HELP, missing something.
Code: Select all
<?php
$imgpath = '/shushmedeals/templates/shushme_deals/images/';
//$bgimgID = $item->id;
$bgimgID = isset($_GET['categoryId']);
$bgimgID = $_GET['categoryId'];
echo $bgimgID;
//echo 'shoot her eman';
//echo $imgpath;
if($bgimgID){
$bgimgID = 1;
$filename = '/shushmedeals/templates/shushme_deals/images/bg_home.jpg';
}
if($bgimgID = 2){
$filename = '/shushmedeals/templates/shushme_deals/images/shushme_bg_img1.jpg';
}
if($bgimgID = 3){
$filename = '/shushmedeals/templates/shushme_deals/images/shushme_bg_img2.jpg';
} else {
$filename = '/shushmedeals/templates/shushme_deals/images/shushme_bg_img3.jpg';
}
if($filename){
echo '<br>'.$filename;
// SET COOKIE
//setcookie('bgimg', $filename);
//echo $_COOKIE['bgimg'];
} else {
echo "There is no Background for this category";
// DO NOT SET COOKIE
}
// Print an individual cookie
echo $_COOKIE["location"];
?>