Jump to content

Dynamic $_SESSION Variable - Help


ggensale

Recommended Posts

I'm trying to create a dynamic $_Session variable by:

 

$_Session[$i] = "value";

 

After I post my form the session variable in gone. 

 

Any ideas?

 

Are you using session_start() on top of the page?

 

Do you have any $_POST with the same names? (in this example, $_POS[$i])

Link to comment
Share on other sites

I do have session_start();

 

Here is a better explaination of what I'm doing...I have another page in which a user will fill out a form asking them how many "items" for each section do they want to create.

 

That gets posted to the new page... And here is the code I'm using to store them:

 

foreach($_POST as $section => $value) {

    if ($value > 0)

    {

$_SESSION[$section] = "$value";

    }

}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.