Hello
I'm new to PHP session variables, and I'm doing some work for a client whose website uses session variables in a form that contains image verification. There's a problem with the form - it appears that a session variable is being forgotten. So I wrote this quick test script to investigate:
Now, on my own website, each time I refresh the page, the code at line 1 prints an empty value (as expected); the code at line 3 prints the session variable set the previous time I viewed the page; and the code at line 5 prints the value of the session variable set this time round.
On my client's server, though, line 3 always returns an empty value - as if the session variable, or the whole session, is being forgotten between page refreshes. Apologies if this is a stupid question, but can anyone give me any pointers as to what might have changed recently on my client's server to have caused this problem?
Many thanks
Dave
I'm new to PHP session variables, and I'm doing some work for a client whose website uses session variables in a form that contains image verification. There's a problem with the form - it appears that a session variable is being forgotten. So I wrote this quick test script to investigate:
Code:
$html = "Pre session start - myvalue = " . $_SESSION['myvalue'] . "<br /><br />";
session_start();
$html .= "Post session start - myvalue = " . $_SESSION['myvalue'] . "<br /><br />";
$_SESSION['myvalue'] = str_shuffle('abcdefg');
$html .= "Just set myvalue = " . $_SESSION['myvalue'] . "<br /><br />";
echo $html;
On my client's server, though, line 3 always returns an empty value - as if the session variable, or the whole session, is being forgotten between page refreshes. Apologies if this is a stupid question, but can anyone give me any pointers as to what might have changed recently on my client's server to have caused this problem?
Many thanks
Dave
Comment