php session variable

Posted by Idealflip on Stack Overflow See other posts from Stack Overflow or by Idealflip
Published on 2010-05-06T17:04:58Z Indexed on 2010/05/06 17:08 UTC
Read the original article Hit count: 226

Filed under:
|

Hi Everyone, my session variable seems to keep dropping its array values. What could I be doing wrong? Is it my object?

if(isset($_SESSION['locations'])){
    $_SESSION['locations']->listItems($_POST['companyLocation']);
    echo "session exists";
}else{
    $_SESSION['locations'] = new Location();
    $_SESSION['locations']->listItems($_POST['companyLocation']);
    echo "session does not exist";
}

class Location {

    function listItems($location){
        $array;
        $array[] = $location;
        print_r($array);
    }

© Stack Overflow or respective owner

Related posts about php

Related posts about session