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:
Expand|Select|Wrap|Line Numbers
- $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