Can someone look at the following code and see if you can spot a problem with it?
Purpose:
I'm using this to try to look at a property class for a realty website. if the page has a property class assigned to it, it will use the corresponding number jpg file for the header. In other words, i have header image files named 1.jpg, 2.jpg, 3.jpg, etc to correspond with property classes 1,2,3, etc. If a page doesn't have a property class, it will use the default header image which is assigned in the else portion of the syntax. Please give me your thoughts. I'm inserting this code in an html page where the header should be displayed.
Problem:
All it's doing is displaying the default header image on all pages, even though a property class is assigned.
Thanks!
<?php
//start by checking if we're viewing a property class
if(isset($_GET['pclass%5B%5D']))
{
//we are! lets get the matching image
$classimg = $_GET['pclass%5B%5D']; //assign the property class number
$headerimg = '{template_url}/images/'.$classimg.'.jpg'; //make the image url
//echo $classimg;
}
else
//No property class, lets just view the main logo for the site
{
$headerimg = '{template_url}/images/logo.jpg'; //set this to your default site logo
//echo 'Normal header';
}
//show the image
echo '<img src="'.$headerimg.'" height="164" width="950">';
?>