Jump to content

DimitriosZ

New Members
  • Posts

    1
  • Joined

  • Last visited

DimitriosZ's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have just did this php code for the high-low game but the $tries variable always goes down to 0 when I refresh..Can someone help me to return the $tries to browser with the url? Thank you <html> <?php $tries = 0 ?> <body> <form action="http://195.251.218.44/code/workspace/fin19178/2021/ergasia2/askisi2.php" method="post"> Make a guess: <input type="number" name="number" id="number" required> <input type="submit" value="Guess"> </form> </body> </html> <?php function High_Low($guess){ $tries += 1; $hidden_number= 74; if ($guess < $hidden_number) { return "Give me a higher number!"; } elseif ($guess > $hidden_number) { return "Give me a lower number!"; } else { return "Congratulations,You have found it in:" . $tries . " tries!"; } } ?> <?php echo High_Low($_POST["number"]); ?>
×
×
  • 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.