Question : Default PHP and If Statement Issue

On http://www.jrocam.com I am using the code below to show a different image on each page. However, when you go to http://www.jrocam.com the default page does not show an image. The default page is demo and when you click demo in the nav bar it shows up fine. Anyone know what I need to do to get the correct version of demo to show up when you go to http://www.jrocam.com
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
<?php
		
		if($_GET['p'] == "about"){
		
		 echo '<img src="images/about-image.gif" alt="" width="308" height="150" class="standardW" />';
		
		}elseif($_GET['p'] == "newresume"){
		
		 echo '<img src="images/resume-image.gif" alt="" width="299" height="150" class="standardW" />';
		
		}elseif($_GET['p'] == "contact"){
		
		 echo '<img src="images/contact-image.jpg" alt="" width="263" height="150" class="standardW" />';
		
		}elseif($_GET['p'] == "resume"){
		
		 echo '<img src="images/other-exp-image.jpg" alt="" width="270" height="150" class="standardW" />';
		 
		 }elseif($_GET['p'] == "demo"){
		
		 echo '<img src="images/home-image.gif" alt="" width="270" height="150" class="standardW" />';
		 
		  }elseif($_GET['p'] == "demo"){
		
		 echo '<img src="images/home-image.gif" alt="" width="270" height="150" class="standardW" />';
		
		}elseif($_GET['p'] == ""){		}elseif($_GET['p'] == ""){
		
		 echo '<img src="images/home-image.gif" alt="" width="367" height="150" class="standardW" />';
		
		} else{
		
		 // blank
		 echo '';
		
		}
		
		?>

Answer : Default PHP and If Statement Issue

It is one of 2 things:

1. When you go there directly there, no $_GET is established. $_GET['p'] will probably be equal to NULL, NOT "" and therefore it goes through your final else statement that outputs no image.

Or 2. If the code above is correct, you have 2 elseif statements for $_GET['p'] = "" and the first one doesn't do anything and will be the only one that fires. Remove it and the above code might work...
Random Solutions  
 
programming4us programming4us