Join Kevin Skoglund for an in-depth discussion in this video Add a form for year selection, part of Easy PHP Projects: Single-Serving Sites.
- In this movie we'll build on the work we did…in the previous movie and improve our,…"is this a leap year" Single-Serving site.…So it occurs to me that there are two different…improvements we can make to this page.…First, we can take all of this test for…whether something is a leap year or not…and roll that up into a function…that just simple returns true or false.…I think that would be cleaner programming.…Second, we can give the user a web form…so they can submit any year they want…not just the current year,…and that way we wouldn't have to hack this value.…We could just let the user type in any year and find out.…
By default we can use the current year though.…So let's modify this and…we're going to change this into a function.…Is leap year and we'll pass in a year to it…and inside that function I'll take all of this code,…but instead of having a value set…we're just going to return false,…return true,…return false,…and return true.…
Here we go. Make all those line up.…So that's it.…It should return true or false…
- Finding and validating an IP address with PHP
- Parsing the HTTP request for browser details
- Comparing dates and times in PHP
- Randomizing data with PHP
- Styling page content dynamically
- Generating random sentences
Skill Level Beginner
1. What is My IP Address?
2. Browser Mirror
3. Is it New Years Yet?
4. Random Data and Styling
5. Random Phrase Generator
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.