It is just one page called me.php
[PHP]<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>Find the number ...</title>
</head>
<body>
<h3>Find the numer generated by your PC between 1 and 100 </h3>
<?php
// I make a counter to save the number of attempts
if (! isset($teller)){
$teller = 1;
}
// The aim is that the computer takes a number in mind
// And that the user can find. I give hints of higher and
// Lower ...
srand((double) microtime() * 100000);
// Does the recommended number exit?
if (! isset($recommended_number)){
// Apparently there is not yet ... so I create a new one
$recommended_number = rand(1,100);
} else {
if ( isset($answer) && $answer != '' ){
// See if the answer is higher or lower (or correct)
if ($answer > $recommended_number){
$message = "Pleas --";
$teller++;
} elseif ($answer < $recommended_number){
$message = "Pleas ++";
$teller++;
} else {
$message = $teller > 1 ? "Your number is correct! And you have found this in " . $teller . " attempts!"
: "Your number is correct! And you have found this in 1 attempt!!";
$recommended_number = rand(1,100);
$teller = 1;
}
}
}
echo ("<font color=\"#FF0000\">" . $message . "</font> <br />");
?>
<form method="GET" action="me.php">
Take a gamble:
<input name="answer" value="<?php echo $answer?>"><br />
<input type="hidden" name="recommended_number" value="<?php echo $recommended_number?>">
<input type="submit" value="Find it ...">
</form>
</body>
</html>[/PHP]
I always get the same message:
Your number is correct! And you have found this in 1 attempt!! , each time I click on the submit, the variable teller doesn't change its value !!
Why ?
Thanks