Hi all,
I am trying to store data in a $_SESSION variable (an array), but it reverts to
empty every time my page is refreshed (due to a submit button click).
I read the answer to the post "$_SESSION comes empty on next page" dated
2/4, whaich seems to be my problem. But the suggestions do not help me at all
<see 1 & 2 below>
1-have you set session.save_pa th ?
2-if you are using virtualhosts put this at the top of your .php file:
session_set_coo kie_params(3200 , '/', $_SERVER['HTTP_HOST']);
I have tested the array $_SESSION['list_array'] with both empty and !isset
and it returns true in both cases after a page refresh or when moving to
another page all together.
Is there something that I am missing...here is some of my code:
<?php
if (!isset($_POST['build_it'])) // if this is not the final submit, but
the first form display or redisplay
{
if (isset($_POST['add'])) // this is just the posting to the array
{
if (empty($_SESSIO N['list_array']))
{
$_SESSION['list_array'] = array(1 => $_POST['list_member']);
print "created and added...<br />";
}
else
{
$_SESSION['list_array'][] = $_POST['list_member'];
print "added...<b r />";
}
print_r ($_SESSION['list_array']);
}
TIA,
Miki
I am trying to store data in a $_SESSION variable (an array), but it reverts to
empty every time my page is refreshed (due to a submit button click).
I read the answer to the post "$_SESSION comes empty on next page" dated
2/4, whaich seems to be my problem. But the suggestions do not help me at all
<see 1 & 2 below>
1-have you set session.save_pa th ?
2-if you are using virtualhosts put this at the top of your .php file:
session_set_coo kie_params(3200 , '/', $_SERVER['HTTP_HOST']);
I have tested the array $_SESSION['list_array'] with both empty and !isset
and it returns true in both cases after a page refresh or when moving to
another page all together.
Is there something that I am missing...here is some of my code:
<?php
if (!isset($_POST['build_it'])) // if this is not the final submit, but
the first form display or redisplay
{
if (isset($_POST['add'])) // this is just the posting to the array
{
if (empty($_SESSIO N['list_array']))
{
$_SESSION['list_array'] = array(1 => $_POST['list_member']);
print "created and added...<br />";
}
else
{
$_SESSION['list_array'][] = $_POST['list_member'];
print "added...<b r />";
}
print_r ($_SESSION['list_array']);
}
TIA,
Miki
Comment