Hi
Im using the rand() function to generate a random integer. Every time the page refreshes I want the new random number to be added to the previously generated random number, thus creating a running total of randomly generated numbers…this is what I have so far but its not working, I making use of sessions to store the random number…any assistance will be much appreciated
[php]<?php
$random = rand();
$newRandom = 0;
echo "The random number is ".$random;
echo “
”;
echo “
”;
session_start(); // start a session
$_SESSION[‘random’] = “$random”;
if(isset($_SESSION[‘random’])){ // check if the random number is stored in the session
$newRandom += $random;
echo $newRandom;
}
echo “
”;
echo “
”;
//echo "The random number is now "//.$newRandom;
?> [/php]