Click to See Complete Forum and Search --> : sessions


leyn
September 19th, 2003, 09:30 AM
When are sessions used?
I have a products list page with a checkbox besides each product. The user checks the products he wants to order for & clicks on submit button. The list of checked products by the user is sent as a mail to the admin. So for this do I have to uses sessions??

ZoSoo7
September 19th, 2003, 12:08 PM
First off, no, you do not need a session for what you are doing. All you need to do is have the form submitted to some kind of server side script file (asp,jsp,php, etc) and you can access the forms values that way.

Sessions are generally used to hold state. Since the web is stateless, and you can't declare a variable and access that variable on a different page; sessions are sometimes necessary. For example if I have a value that I want to hold and I have a series of 10 pages and I need this value all the way through it, I could use a session to hold that value. A lot of people say to stay away from sessions, but as long as you kill them, they're fine. But in your case, you don't need to worry about it on this one.