Posted by carlton on 07/17/06 20:14
I have tried to run this simple self calling script, but each time it
calls its self I always get the "Value of guess not set." message.
Any ideas on the problem?
Thanks in advance.
Carlton.
<?php
$num_to_guess=42;
$message="";
if (!isset($guess))
{
$message= " Welcome <BR>Value of guess not set. " ;
}
elseif ($guess > $num_to_guess )
{
$message="Number too BIG";
}
elseif ($guess < $num_to_guess )
{
$message="Number too SMALL";
}
else
{
$message="Guess CORRECT";
}
?>
<HTML>
<HEAD>
<TITLE>Number Guessing Script</TITLE>
</HEAD>
<BODY>
<H1>
Message is; <?php print $message ?>
</H1>
<?php
print "<BR>\$_SERVER[PHP_SELF] = ".$_SERVER["PHP_SELF"];
if(isset($guess))
{
print"<BR>guess value is ". $guess;
}
else
{
print "<BR>Value of guess NOT set.";
}
?>
<FORM ACTION="selfcall.php" METHOD="POST">
Type our guess here:<INPUT TYPE="TEXT" NAME="guess">
</FORM>
</body>
</html>
Navigation:
[Reply to this message]
|