Jump to content

[SOLVED] Data disappearing in my sessions


Guardian-Mage

Recommended Posts

I have one page. It says

session_start();
$_SESSION['limit] = $limit;
echo $_SESSION['limit'] //Will write out 50

The page than submits a form with post data to another page

session_start();
$limit = $_SESSION['limit'];
echo $limit //Will write out "Array"

Why isn't my second page printing out 50? I am using PHP 4.4.2 and Apache  1.3.36. It works fine With PHP 5.2.6 and Apache 2.2.8

Link to comment
https://forums.phpfreaks.com/topic/105166-solved-data-disappearing-in-my-sessions/
Share on other sites

Try this.

 

first page.

<?php

session_start();

$limit = 50;

$_SESSION['limit'] = $limit;

echo $_SESSION['limit']; //Will write out 50

?>

 

2nd page.

<?php

session_start();

$limit = $_SESSION['limit'];

echo $limit; //Will write out "Array"

?>

 

these code are tested.

 

Do you have anther variable called limit in your code or perhaps a form field called limit which is any array and does your have have register_globals enabled

 

echoing $_SESSION['limit'] or $limit in your second page should not return "array"

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.