Because URL parameters may be present some times and not other times, it is important to handle both and to learn to set default values.
- [Instructor] In this movie,…I want to talk about how to work with missing URL parameters…and how to set default values for them.…In the last movie,…we learned how we can retrieve values…from the associative array inside the GET super global.…This process of retrieval and assignment works great,…provided that there is a value to be found.…In other words, if page wasn't sent in the URL,…then a value would not be set inside the associative array…and when PHP went to look for this value,…it would raise either a warning or a notice to us…telling us that the index can't be found.…
Now, you can configure PHP to not show…those warnings and notices,…but it's a much better practice…to go ahead and fix the problem.…We want to check and make sure that the value is present…before we try to retrieve it.…One way that we can do that is by using an if statement.…We can use if along with the PHP function isset…to check and see if that value exists.…So if isset then use that value and assign it to page.…If not, then we can use some default value…
- Organizing project files
- Including and requiring files
- Working with URL parameters
- Encoding dynamic content
- Modifying headers and page redirection
- Creating forms and processing form data
- MySQL basics
- Using PHP to access database tables
- Creating, reading, updating, and deleting database records with PHP
- Validating data
- Preventing SQL injection
Skill Level Beginner
1. Start a Database-Driven Project
2. Build Web Pages with PHP
3. Headers and Redirects
4. Build Forms with PHP
5. MySQL Basics
6. Use PHP to Access MySQL
7. CRUD with PHP
8. Validate Data with PHP
9. Prevent SQL Injection
Next steps1m 8s
- 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.