If... Else and Images

Um, hello. :)

I’m trying to use the If Else / Else If function with images. Unfortunately I have run into a huge road-block and was wondering if anybody could help.

Thanks.

Richard Escobedo
http://blog.richard-escobedo.com

Well… We would need some code, and a description of what you are trying to do, and why it isnt working to help you :-)

<?php $p=Page("P"); if ($p=="http://php.richard-escobedo.com/general/play.php") echo ""; elseif ($p=="http://networks.richard-escobedo.com/advertising/index.php") echo ""; ?>

What I am trying to do is display an image with PHP only when the user is on a certain page… can y’all help? :slight_smile: Thanks a lot!!! :)

o_O I see a few problems it should look a little something like this instead.

Although I don’t understand the linking but I’ll modify it a bit and maybe you can see from it?

[code]
Play
Home

<?php if ($p == "Play") { Echo ""; } else if ($p == "Index") { Echo ""; } ?>[/code]

However, what if I want it [the page] to be index.php, or play.php vs. Index, or Play?

[php]$page = basename($_SERVER[‘PHP_SELF’]);

if ($page == ‘play.php’)
{
echo ‘…’;
}
[/php]

much easier…

if your page is whatever/play.php then

[code]

[/code]

else if your page is whatever/index.php then

[code]

[/code]

else if you want to stay in one page…

Play
Index

[code]<?php
$p=$_REQUEST[‘p’];

if ($p==‘play’)
{
Echo ‘’;
} else if ($p==‘index’)
{
Echo ‘’;
}
?>[/code]

Sponsor our Newsletter | Privacy Policy | Terms of Service