How do I set Session Variables

This is a discussion on How do I set Session Variables within the PHP General forums, part of the PHP Programming Forums category; I'm starting with a form that has 23 fields and I need to be able to pass and recall ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-22-2006
christopher.j.just@gmail.com
 
Posts: n/a
Default How do I set Session Variables

I'm starting with a form that has 23 fields and I need to be able to
pass and recall the information from page to page as people move
through the form process.

How do I set the variables to include all the form elements and how do
I recall them in each subsiquent page.

Previously we had been using hidden includes, but we're looking for a
more elegant and consistant solution.

Thanks,
Chris

Reply With Quote
  #2 (permalink)  
Old 08-22-2006
Lupus
 
Posts: n/a
Default Re: How do I set Session Variables

Dear Chris,

First of all you need to initialize the session :
session_start();

You have to do this on every page during the session. I'm not sure, but
it's possible that you have to put this in the script before any
output...

After that, the session variables are stored in the array $_SESSION[] :
session_start();
$_SESSION['foo'] = "bar";
---- next page ----
session_start();
echo $_SESSION['foo'];


kind regards,
Mathew


christopher.j.just@gmail.com wrote:
> I'm starting with a form that has 23 fields and I need to be able to
> pass and recall the information from page to page as people move
> through the form process.
>
> How do I set the variables to include all the form elements and how do
> I recall them in each subsiquent page.
>
> Previously we had been using hidden includes, but we're looking for a
> more elegant and consistant solution.
>
> Thanks,
> Chris


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:05 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0