Jump to content

oneoption

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

oneoption's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. It is working now. The last issue is now.. I need to echo something, if the abs of the guessed number is >50 . Here is some of the code if ($guess<1 || $guess>100) { echo ".."; } else { if($guesst!=$_SESSION['target']) { echo "wrong. the correct number was..." . $_SESSION['target']; } else if // This is where i am stuck, i come so far to know i have to use abs something. { echo "Way to High"; }
  2. i've got the task to create a Guessing game, where you guess the number between 1-100. Also there has to be a number of maxium guesses..10. but just cant figure it out . It's in danish. so thats why the ? is everywhere:p <html> <head> <title>G?tteleg</title> </head> <body> <?php session_start(); $_SESSION['antal'] = 10 ?> <form action="guess2.php" method="POST"> G?t Nummer!: <input type="number" name="g?t"<br/> <input type="submit" name="send" value="G?t"> </form> </html> </body> <?php session_start(); $rand = rand(1, 100); $g?t = $_POST['g?t']; $send = $_POST['send']; echo $_SESSION['antal']; $_SESSION['antal']--; if ($g?t<1 || $g?t>100) { echo "Dit g?t skal v?re mellem 1 og 100"; } else if($g?t!=$send) { echo "Forkert... Det rigtige nummer var.." . $rand; } else { echo "Godt G?ttet"; } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.