Jump to content

[SOLVED] very quick and easy for php intermediate!


fri3ndly

Recommended Posts

Please can someone help me out here:

 

I am trying to make an IF statement that is something like this, you will get the general idea what I am trying to do but I really have not got my head round IF statements. Please help, thank you

 

 

 

<?php

 

if (page="?page=about.txt")

 

"<img src="images/aboutbar.jpg" width="800" height="141" />" ;

 

}

 

if (page="?page=services.txt")

 

"<img src="images/servicesbar.jpg" width="800" height="141" />" ;

 

}

 

else{

 

<img src="images/homebar.jpg" width="800" height="141" />

?>


Ok, so this is my script now, but I keep receiving errors. Obviously I cannot echo an image to show up, so that is obviously wrong, anything else anyone notices? I think the script is not liking the html, do I need to end the php tags and restart them for each part of html?

 

	  if($_GET

==about.txt){
  
  echo "<img src="images/topleftbartest.jpg" width="800" height="141"/>";
  
  }elseif{
  echo "<img src="images/topleftbartest2.jpg" width="800" height="141"/>";
  
  }else{
  echo "<img src="images/topleftbartest2.jpg" width="800" height="141"/>";
              }
  ?>


switch($_GET


){

case "about.txt":

  echo '<img src="images/topleftbartest.jpg" width="800" height="141"/>';

break;

case "":

  echo '<img src="images/topleftbartest2.jpg" width="800" height="141"/>';

break;

default:

  echo '<img src="images/topleftbartest2.jpg" width="800" height="141"/>';

break;

}


thank you very much. That makes sense and the default image shows up, but the selected images do not.

 

	  <?php
  
switch($_GET

){
case "index2.php?page=about.txt":
  echo '<img src="images/topleftbar1.jpg" width="800" height="141"/>';
break;
case "index2.php?page=services.txt":
  echo '<img src="images/topleftbar2.jpg" width="800" height="141"/>';
break;
default:
  echo '<img src="images/topleftbar.jpg" width="800" height="141"/>';
break;
}
  ?>

 

I have tried changing the page names, but that is what the page name changes to in the top of the browser

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.