Jump to content

[SOLVED] Using PHP to nab a random URL and display


scott.stephan

Recommended Posts

I currently have a little test I'm trying to run and hitting a wall.

<?php

$header_img_urls=array('http://ilovepr.com/media/upload/image/tile1(1).jpg','http://ilovepr.com/media/upload/image/vegg-tile.jpg','http://ilovepr.com/media/upload/image/tile2(2).jpg');
$rand_img=rand(0,count($header_img_urls)-1);
$url=$header_img_urls[$rand_img];

?>
"gfgcv";
<?php echo $url; ?>
<h1><img alt="" src="<?php $url; ?>" /> </h1>

 

It echos fine, but it never outputs anythig to the "src". It comes up blank everytime. What stupid thing am I missing?

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.