Re: Receiving ARRAY from Forms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I tried the following code but all I get back is "Array".  I'm trying to
pass
> a huge array.

You need to serialize the array...

> <?
> if( isset( $submit ) )
> {
> echo "array list:<br>";
> print_r( $eList );
> $submit = "";
> }
> else
> {
> $mList = array();
> $mList[0] = "1. hello";
> $mList[1] = "2. there";
> $mList[2] = "3. How are you";

$mList = serialize($mList);

> $fShow = <<<EOD
> <p>Press Submit Button to test</p>
> <form method="POST" action="$PHP_SELF" name="Test Array">
>   <p><input type="submit" value="Submit" name="submit">
>   <input type="reset" value="Reset" name="B2"></p>
>   <input type="hidden" name="eList[]" value="$mList">
>   </form>
> EOD;
>
> echo $fShow;
> }
> ?>

and unserialize() it on the receiving page to get your array back. If
magic_quotes is on, be sure to stripslashes() it before unserialize()ing it.

---John Holmes...


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux