Switch to full style
:read: Start PHP with us. Includes topics to help you in php
Post a reply

A PHP Number Guessing Script

Sun Oct 26, 2008 6:36 pm

Code:
<?php
$num_to_guess 
= 99;
$message = "";
if ( ! isset( $guess ) ){
   $message = "Welcome to the guessing machine!";
}elseif(
 $guess > $num_to_guess ){
   $message = "$guess is too big!";
}elseif(
 $guess < $num_to_guess ){
   $message = "$guess is too small!";
}
else {
    $message = "Well done!";
}
?>

Code:

<html>
<head>
<title>A PHP number guessing script</title>
</head>
<body>
<h1>
<?php print $message ?>
</h1>
<form action="<?php print $PHP_SELF?>" method="POST">
  Type your guess here: <input type="text" name="guess">
</form>
</body>
</html>




Post a reply
  Related Posts  to : A PHP Number Guessing Script
 convert integer number to octal,hexadecimal number systems     -  
 convert octal number to decimal number     -  
 convert decimal number to octal number     -  
 Can anyone suggest some script?     -  
 need help with java script in a pdf     -  
 Questions: Perl Script. PHP.     -  
 Script ingoring lines     -  
 script for including files     -  
 Send Email from a PHP Script Example     -  
 Boonex Dolphin PHP script is SCAM!!!     -  

Topic Tags

PHP Forms