This code for guessing a number between 1 and 10 but it is not working. Please post the fixed code thankyou!
<html>
<head>
<title>Guess the number</title>
<head>
<body>
<form action="action.php" method="post">
<input type="number" name="guess"><br/>
<input type="submit" name="submit" value="Guess"
</form>
<body>
</html>
<?php
$randomnumber= mt_rand(1,10);
$guess = $_POST['guess'];
$submit = $_POST['submit'];
if(isset($submit)) {
if (($number> 0)&&($number< 11)){
if($guess!=$randomnumber) {
echo "Incorrect, the correct answer is ".$randomnumber;
} else {
echo "That is right! The correct answer is ".$randomnumber;
}
}
?>
Sorry I'm very new to coding. Please help :)
Aucun commentaire:
Enregistrer un commentaire