I'm working on a simple php/html page that wants to include an external html file selected at random on load, from a group of 3. And I need help! The code I have is: Code: <?php $randContent = array_rand('gift1.html', 'gift2.html', 'gift3.html'); include($randContent); ?> PHP: It's not working. I have gift1.html, etc. stored in the same folder. On execute, this is the error message I get, pertaining to the code above: Warning: Wrong parameter count for array_rand() in /home/content/p/e/r/perfectseason/html/giving-dyn.php on line 258 Warning: include() [function.include]: Failed opening '' for inclusion (include_path='.:/usr/local/php5/lib/php') in /home/content/p/e/r/perfectseason/html/giving-dyn.php on line 259 The page is online at theperfectseason-dot-com-slash-giving-dyn.php in case my hero-helper wants to look at the entire source.
it is because array_rand only accept paramete one as an array, rebuild your array to $pages = array('g1','g2','g3',etc..); $randContent = array_rand($pages);