Re: session array

From: Date: Mon, 07 Aug 2006 17:17:41 +0000
Subject: Re: session array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-240268@lists.php.net to get a copy of this message
Ross wrote: > I am creating an array of sessions > > $_SESSION['results'][] always call session_start() before using $_SESSION > > > There may be up to 7 and I need to know why do I always get the > notice'Undefined index: results in...'? > > How do I define or initialise the array if it only gets set once the form > has been posted (an answer has been given) on the page. > > Is there a way to count/output (FOR EACH?) a set of session arrays like if (is_array($_SESSION['results'])) echo 'number of results is ', count($_SESSION['results']); foreach ($_SESSION['results'] as $number => $data) { echo "result number $number contains:"; var_dump($data); } > this? > > > Ta, > > Ross >

« previous php.general (#240268) next »