Play the Lucky Number Game - Guess the Number Between 1 and 10
<h1>Lucky Number Game</h1>
<p>Welcome to the Lucky Number Game! I'm thinking of a number between 1 and 10. Can you guess it?</p>
<form action="" method="post">
Enter your guess: <input type="text" name="guess">
<input type="submit">
</form>
<?php
if (isset($_POST['guess'])) {
$myNumber = 7;
$guess = $_POST['guess'];
if ($guess == $myNumber) {
echo '<p>You guessed it! The number was 7.</p>';
} else {
echo '<p>Sorry, the number was not ' . $guess . '. Try again!</p>';
}
}
?>
原文地址: https://www.cveoy.top/t/topic/lmlI 著作权归作者所有。请勿转载和采集!