Re: passing array in form HELP!

From: Date: Mon, 04 Dec 2000 21:52:25 +0000
Subject: Re: passing array in form HELP!
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-28646@lists.php.net to get a copy of this message
Remember that there are limits as to how much data you pass through those vairiables - aka don't go passing some large family array into a hidden field all serialized. --Joe On Mon, Dec 04, 2000 at 01:39:50PM -0800, Mark Maggelet wrote: > On Mon, 4 Dec 2000 13:20:38 -0800, Joe Stump (joe@earth.care2.com) > wrote: > >Do this: > > > >if(!is_array($var)) > >{ > > if(strlen($var)) > > { > > $var = explode(',',$var); > > } > > else > > { > > $var = array(); > > } > >} > > > >if(!sizeof($var)) > >{ > > $var = array('Joe','Schmoo','Foo','Bar'); > >} > > > > > >echo '<INPUT TYPE="hidden" NAME="var" > >VALUE="'.implode(',',$var).'">'."\n"; > > this is better: > use serialize(). > > <INPUT TYPE=hidden NAME=var VALUE="<?echo > urlencode(serialize($var))?>"> > > on the next page use: > $var=unserialize(urldecode($var)); > > - Mark > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net ----- Joe Stump, PHP Hacker joestump98@yahoo.com http://www.miester.org/ Need a programmer? http://www.google.com/search?q=%22Joe+Stump%22 ***************************************************************** * RENT THIS SPACE - SEEN BY THOUSANDS EACH DAY! * * Current Sponsor: http://www.smackdown.com * *****************************************************************

« previous php.general (#28646) next »