View Single Post
Old 01-22-2008, 08:11 PM   #1 (permalink)
karq
The Wanderer
 
Join Date: Jan 2008
Posts: 12
Thanks: 0
karq is on a distinguished road
Default Tried to make a guessing game, what do u think?

So I just started a week ago to learn php. Today I tried to make a guessing game.My first tryout :D
What do u think?

PHP Code:
html>
<body>
<form action="opin.php" method="GET">
Vali arv:<input type="text" name="nr"/>
<input type="submit" value="Arva"/>
</form>
<?php
//I used Estonian in this script, U propally wont understand some thing's :D
$number=$_GET["nr"];
$arva=(rand(1,20));
if (isset(
$arva)) {            //Kas genereeriti arv? Kui jh siis jätkame.
if ($number<$arva) {
echo 
"Vähe pakkusid";
    }
else if (
$number>$arva) {
    echo 
"Liiga palju pakkusid";

}
else if (
$Number==$arva) {
     echo 
"Panid täppi!";

}
}
else {
    echo 
"Midagi läks pekki";
}
?>
</body>
</html>
karq is offline  
Reply With Quote