Use PHP to set and read back values stored in the session file.
- [Instructor] In this movie, we'll learn how to use PHP…to set and read values in the session file.…In order to set a value in the session,…all we have to do is use the super global…and assign a value to a key,…just like we would any associative array.…It's that simple.…We don't have to use a special command…like we did with set cookie.…Here, we just simply talk to the associative array…and PHP will then store that value…in the session file for us.…That's very different than…when we're working with a cookie.…We have a live connection, a live association…between the contents of our session file…and the super global session.…
When we want to read a value back,…then we just simply ask for the value…that relates to that key for the associative array.…Here I'm asking for session lang…and I would get back the value English.…It's a good idea to make sure that that value exists.…Otherwise, if we ask for a key in an associative array…that doesn't exist, we'd get an error.…So you want to check and see whether it's set,…and also set it to a default value if it's not there.…
- Creating a content management system
- Building dynamic content navigation
- Using context and function options for conditional behavior
- Hiding content from the public view
- Insecure direct object reference
- Allowing HTML in dynamic content
- Previewing content in the public context
- Working with cookies and sessions
- Storing status messages in the session
- Secure user authentication (login/logout)
- Regulating page access
- Nesting related resources
- Managing an ordered list automatically
Skill Level Beginner
PHP with MySQL Beyond the Basicswith Kevin Skoglund10h 26m Intermediate
MVC Frameworks for Building PHP Web Applicationswith Drew Falkman2h 57m Intermediate
1. Create a Content Management System
2. Build Dynamic Content Navigation
3. Use Context and Options
4. Cookies and Sessions
5. Regulate Page Access
6. Nesting Related Resources
Next steps1m 15s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
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.