Jump to content

random number


jimmyt1988

Recommended Posts

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 &#39;special&#39; 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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.