Passing arrays in a query string is the wrong way to do it. Too many things can go wrong.

You could try creating a form, and sticking the serialize()d array value in to a hidden field. Then POST the form to your gallery page.

<?PHP
echo '<form action="gallery.php" method="POST">
<input type="hidden" name="cart" value="' . serialize($cart) . '"/>
<input type="submit" value="Go To Gallery"/>
</form>';
?>

And in gallery.php
<?PHP
$cart = unserialize($_POST['cart']);
?>

HTH

-Tim

On Jun 30, 2008, at 3:32 PM, chad qian wrote:

Hi,
I want to pass an unknow array cart[]: to "gallery" page through url link:

My url is:gallery.php?final=cart[]

On gallery.php page
I want to output everything in this array

My code is:
$finalcart=array();
$finalcart=$_get['final']
for(var i=0;i<sizeof($finalcart);i++)
   print finalcart[i];


Maybe my code is wrong.I only want to show my need.Can anyone help me to correct my code?

Thanks!

chad


The other season of giving begins 6/24/08. Check out the i’m Talkathon. Check it out!
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to