Re: can I do a for each here??

From: Date: Thu, 17 Mar 2005 15:11:24 +0000
Subject: Re: can I do a for each here??
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-210988@lists.php.net to get a copy of this message
Thanks for all your replies. I liked Jeffs approach as it was more straightforward and using age[Andrea] for the texboxes creates les confusion when doing the foreach statement. I didn't quite get the cookie vs session bit. Are you saying they [cookies] use greater resources? AD "AndreaD" <andrea.davidson@silene.co.uk> wrote in message news:20050317124854.69647.qmail@lists.php.net... >I have about 10 text boxes each taking in value (ages) , The code I have >checks for a value and if it is set it then sets the cookie to that value. >The else just clears the value. On the next page I use a foreach to get the >values but I think there must be a quicker way to collect the data appart >from 10 if-else staements. > > if (isset($andrea){ > > setcookie("cookie[andrea]", "$andrea"); > } > > else {setcookie("cookie[$andrea]", ""); > > } > > > if (isset($james){ > > setcookie("cookie[james]", "$james"); > } > > else {setcookie("cookie[$james]", ""); > > } > > > AD

« previous php.general (#210988) next »