Rectifier
-
Posts
3 -
Joined
-
Last visited
Never
Posts posted by Rectifier
-
-
Thank you Jeff!
It all works great now. :) -
I would like to be able to display 5-10 random images on a page, and have 5-10 different images displayed if the page is visited again, or reloaded.
I've got the displaying the images part done, but the randomizing is faulty. The images are displayed in a random order, but when the page is refreshed/reloaded, or visted again, they are always in the same order (say images 1,5,3,8,4 are displayed, reload, and the same images are displayed in the same order)
[code]<?php
$pics = array("img1.jpg", "img2.jpg", "img3.jpg","img4.jpg", "img5.jpg");
shuffle($pics);
for ( $i = 0; $i < 5; $i++ )
{
echo '<img src="portfolio/' . $pics[$i] . '" border="0"> ';
}
?>[/code]
The shuffle(); function doesn't seem to make it randomize the elements in the array the way I want. Is there another function that does what shuffle(); does, but randomizes the elements in the array the way I want? (Meaning, on reload it reorders the elements in the array.)
php - html question
in PHP Coding Help
Posted
[code]<?php
echo '<input type="text" name="username" value="' . $_POST["username"]; . '">
?>[/code]