From the course: PHP for Web Designers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Ending the PHP session and deleting the data

Ending the PHP session and deleting the data - PHP Tutorial

From the course: PHP for Web Designers

Start my 1-month free trial

Ending the PHP session and deleting the data

Storing values in session variables is useful, but you should always delete them and end the PHP session when they're no longer needed. You can delete individual session variables. And there's also a quick way, to delete them all. In the Hansel and Petal site, let's start by selecting some flowers. So pink calla lilies, we'll have three of those and we'll have oh, let's have five Peruvian lilies. And we'll have some roses, yellow rose. I'm not from Texas, but we'll have some yellow roses. And then we'll add to the basket. So they're listed there, calla lilies, Peruvian lilies, and roses. So, let's try to delete, or to unset the session variable for Peruvian Lilies. We need to go back to our editing program to work on that. So, here we are in order.php. And, at the top of order.php, beginning on line three. We've got an if block, and that runs code only if Post Bouquet has been set. In other words, if we've submitted from the form in Build a Bouquet. So we must make sure that our code…

Contents