I'm trying to do something similar to ICQ's online user notice (if anyone is familiar with that) where an image is displayed based on the the values sent in. For example, if I added <img src="http://www.mydomainname.com/img.php?img=1"> to a page, it would display the image specified when img equals 1. Is this possible? I'm fairly new to PHP so any help would be greatly appriciated. Thanks.
Just do if(img==1) { // display your img }
Nick
I've figured as much... but my problem is getting it to display. I'm not sure what I need to do to get the image to display... I've tried echo and returning the url of it back... Not sure what else to try.
Try this,
<? if ($img=1) { ?> <img src="yourimage.gif"> <? } else // whatever ?>
or just print it.
print("<img src='yourimage.gif'>");
Is that what you mean?
That didn't work either. I'm not sure if you understand what I'm trying to do. I want to make it so I can type <img src="http://mysite.com/img.php?img=#> where # is a number that has an image assigned to it. Is this possible?
Thanks for your previous help by the way.
Now, I see! I don't think so though?
Sorry
I found someone that knew how to do it and they showed me. Thanks for your time though! 🙂
Fantastic! Please tell me how you did it?
<? if ($img == "1") { header("Location: http://www.yoursite.com/yourimage.gif"); exit; } ?>
Then you'd just add more if statements as needed. And you can use it just like a regular image (<img src="http://www.yoursite.com/img.php?img=1">) and it will display the image assigned to that number in img.php.