$_SESSION problem
Posted by: naddie (---.home1.cgocable.net)
Date: February 23, 2010 11:59PM

Sorry if this has been discussed before, but I'm having issues getting the $_SESSION variables to work. I'm just learning to use them so I could easily be missing something.

Using this simple code from a tutorial:

<?php
session_start();

if(isset($_SESSION['views']))
$_SESSION['views'] = $_SESSION['views']+ 1;
else
$_SESSION['views'] = 1;
?>

Refreshing the page doesn't update the counter, as it's recreating the variable each time. Also if I try to pass the variable to another page, it doesn't save either.

Am I missing something here, or is there something on WAMP Server that needs to be configured for it to work?

Options: ReplyQuote
Re: $_SESSION problem
Posted by: c2dan (---.15-1.cable.virginmedia.com)
Date: February 24, 2010 06:25PM

Make sure your browser has cookies enabled. Sessions should work with no configuration needed, by default WAMP configures PHP to save sessions to C:/wamp/tmp (make sure this folder exists and is not set to read only).

Also you should be going to [localhost] to run your PHP scripts.

Options: ReplyQuote


Sorry, only registered users may post in this forum.