construct an image url based on variables.
Posted: Fri Apr 16, 2010 10:46 pm
I need to load a gif image based on a couple of variables
First I am trying to use a $catid that I have successfully echoed to the page from an existing php script.
Secondly the image itself is randomly selected for loading. In the example below, this should load any one of two images as I understand it, and the directory to be determined by the $catid variable
Should this not work? Any pointers?
thanks,
Mark
First I am trying to use a $catid that I have successfully echoed to the page from an existing php script.
Secondly the image itself is randomly selected for loading. In the example below, this should load any one of two images as I understand it, and the directory to be determined by the $catid variable
Code: Select all
<img src="/banners/<? echo $catid; ?>/banner<? echo rand(0, 1); ?>.gif">
thanks,
Mark