How to display random html pages using php
Posted: Fri Nov 20, 2009 4:11 am
Hai
I have some html files and i would like to display them in a random manner using the php.
can any one help me out..I have been trying this one..
but it is not working..
it is displaying the link,when i click the link it is going there
but i require the html file to be displayed automatically without clicking anything
I have some html files and i would like to display them in a random manner using the php.
can any one help me out..I have been trying this one..
but it is not working..
Code: Select all
<?php
$dir = "./clock/";
$arr_file_names = array(1=>'1.html','2.html','3.html','4.html','5.html','6.html','7.html','8.html','9.html','10.html');
$number_of_html_files = count($arr_file_names);
$rnumb = ceil(rand(1,$number_of_html_files));
// test the file name with its file path here -
//echo $dir."clock".$arr_file_names[$rnumb];
//include("$dir."clock".$arr_file_names[$rnumb]");
echo "<a href=".$dir."clock".$arr_file_names[$rnumb].">$arr_file_names[$rnumb]</a>";
?>but i require the html file to be displayed automatically without clicking anything