PhpCode

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Rubel Rana
Forum Newbie
Posts: 4
Joined: Sun Jun 29, 2014 8:18 am

PhpCode

Post by Rubel Rana »

Code: Select all

<?php


$total = "3";

// Change to the type of files to use eg. .jpg or .gif
$file_type = ".jpg";

// Change to the location of the folder containing the images
$image_folder = "random";

// You do not need to edit below this line

$start = "1";

$random = mt_rand($start, $total);

$image_name = $random . $file_type;

echo "<img src=\"$image_folder/$image_name\" alt=\"$image_name\" />";


?>


My question is if i run this code,in browser it just show the image name,not the image , what is the wrong with the code?? I want to show the images..
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: PhpCode

Post by Celauran »

Have you checked what is being output? Confirmed that the path exists as specified?
Rubel Rana
Forum Newbie
Posts: 4
Joined: Sun Jun 29, 2014 8:18 am

Re: PhpCode

Post by Rubel Rana »

Thx i fixed it.
Post Reply