jimmyt1988 Posted September 25, 2009 Share Posted September 25, 2009 Hi all, this is my html page: <div id="didYouKnowText"> <p><? $didYouKnow = $random; require 'didYouKnow.php';?></p> </div> this is my php page: <? $min = 0; $max = 3; $random = rand($min , $max); switch ($didYouKnow){ case 0: echo ('In a magazine right-side Ads generate more interest than left side, and this is reflected in the rates'); break; case 1: echo ('Publication will rarely accept artwork in pantone, or 'special' colours'); break; case 2: echo ('Wet proofs are actually dry'); break; case 3: echo ('Print area, trim area and type area are not the same'); break; } ?> How do i make it randomly generate that number when page refreshes.. to display the difference cases. Link to comment https://forums.phpfreaks.com/topic/175524-random-number/ Share on other sites More sharing options...
smerny Posted September 25, 2009 Share Posted September 25, 2009 switch ($didYouKnow) change to switch ($random) ---- and get rid of "$didYouKnow = $random; " Link to comment https://forums.phpfreaks.com/topic/175524-random-number/#findComment-924895 Share on other sites More sharing options...
jimmyt1988 Posted September 25, 2009 Author Share Posted September 25, 2009 Duhhh, I love you. hahaha Link to comment https://forums.phpfreaks.com/topic/175524-random-number/#findComment-924897 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.