sessions

I was learning sessions this week, and everything was working perfectly on my local host (using xampp) but when I upload the files to my online host (hosted by one.com), the session variables are not being saved.

I made a very simple test-case:

The first php file that links to the second.
[php]

<?php session_start(); $test = "lorem ipsum"; $_SESSION['test'] = $test; ?> test

test2

<?php echo $_SESSION['test']; ?>

[/php]

The second php file that also links back to the first.
[php]

<?php session_start(); ?> test

test

<?php echo $_SESSION['test']; ?>

[/php]

By visiting the first page I expect to set the variable [tt]$_SESSION[‘test’][/tt],
then when I visit the second page through the link, the variable would still be there.

On my localhost both page output the link and the paragraph,
on my online host, the second page only outputs the link…

everything looks fine to me, I even just tested it out and it works properly

Strange, so it probably is some setting on the server that is preventing it from working for me?
Any idea which setting and where I can change it?

I contacted my provider and they said sessions should be supported…

So I got a reply from my provider today,
apparently notepadd++ was saving my file in a wrong format, a quick conversion solved all my problems. :slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service