Re: passing array in form HELP!
| From: | Matt | Date: | Tue, 05 Dec 2000 00:54:58 +0000 |
| Subject: | Re: passing array in form HELP! | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-28674@lists.php.net to get a copy of this message | ||
Use the Serialize and Deserialize functions
----- Original Message -----
From: "Joe Stump" <joe@earth.care2.com>
To: "John Hanson" <jhanson@a440studios.com>
Cc: <php-general@lists.php.net>
Sent: Monday, December 04, 2000 4:20 PM
Subject: Re: [PHP] passing array in form HELP!
> 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";
>
>
> On Mon, Dec 04, 2000 at 03:13:58PM -0600, John Hanson wrote:
> > I can not get an array to pass in a form as a hidden variable! It
allways returns a string.
> > I want to pass additional info in a form (not info in the form itself)
with POST method
> > This is what I'm doing:
> >
> > IN FORM------>
> > $info=array("first_name"=>"John",
> > "middle_init"=>"R",
> > "last_name"=>"Hanson");
> >
> > echo "<input type=\"hidden\" name=\"info\"
> > value=\"".$info."\">";
> >
> > IN 2nd PAGE---->
> > $info=$HTTP_POST_VARS["info"];
> >
> > THIS LINE;
> > echo "info is=>".gettype($info);
> >
> > PRINTS --->
> > info is=>sring
> >
> > WHY IS IT A STRING??
> >
> >
> >
> >
>
> -----
> 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
> *
> *****************************************************************
>
>
> --
> 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
>