From the course: PHP Practice Challenges

Unlock this course with a free trial

Join today to access over 25,600 courses taught by industry experts.

Write a number guessing game

Write a number guessing game

From the course: PHP Practice Challenges

Write a number guessing game

(bright music) - [Instructor] Over the last few challenges, you've compared numbers, processed forms, and even created a cookie to store data. Now it's time to put it all together by writing a number guessing game. Here are the requirements. The game will generate a random number and store it in a cookie. You should accept input from the user, a single number that will be the guess. A form is provided for this. When a guest is submitted a check guest function will determine if the guess is correct, too low, or too high, then tell the user. If the guest is correct, the cookie should be deleted, the form hidden and the user given the option to guess again. Some important notes. There are a lot of ways to achieve this. So your solution could look very different from mine. And remember that cookies need to be set and deleted before anything else is printed. Allowing the user to guess again can simply just be a link to the page causing the browser to refresh and making it forget the…

Contents