Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by frazto

  1. That's ideal, exactly what I was looking for thanks!
  2. Hi there!Now bear with me as i am a total amateur when it comes to PHP...I currently use a bit of script to randomly select an image from an array on refresh and this works fine;<?php $imagearray=file('backgrounds.inc.php'); $imagenum=rand(0,count($imagearray)-1);?><style type="text/css">#image {position: relative;top: 150px;left: 0px;margin: 0px;width: 800px;height: 400px;background : url(<?php echo $imagearray[$imagenum];?>) #FFFFFF repeat;}</style>What I would like to do however is match the image to some text which describes it eg;if ( $imagearray[$imagenum] == "images/bg.jpg" ) include ("info.html");BUT I would like not to have to type out a list of every possible eventuality ie bg1, bg2, bg3, bg4 etc... Instead it would match the number of the info.html file to the number of the bg.jpg file.Also, currently the echo $imagearray[$imagenum] command echos: images/bg.jpg, but I can't get $imagearray[$imagenum] to equal images/bg.jpg.Any help on this would be greatly appreciated.I hope it makes sense.
  • Create New...