Jump to content

Sessioning an array?


Spreegem

Recommended Posts

I am trying to sesssion an array, and then get some data from the array after some form data is submitted to another page, but when I try and get data from it, the array is blank. Is it even possible to session arrays, or am I doing something wrong in my code?

[code]
//From page 1
$_SESSION['h_class'] = $class_array;

//From Page 2
$class_array = $_SESSION['h_class'];
$h_class = $class_array["$num"];
[/code]
Link to comment
Share on other sites

That looks ok, except you really don't need the double quotes in this line:[code]<?php $h_class = $class_array["$num"]; ?>[/code]

Do you have a "session_start()" line at the start of each script?
If you put the line [code]<?php echo '<pre>' . print_r($_SESSION,true) . '</pre>'; ?>[/code] right after the sessions_start(), what displays?

Ken
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.