At 12:13 AM 7/1/2008, Anirudh Zala wrote:
On Tuesday 01 Jul 2008 03:09:48 Tim Lieberman wrote:
> Passing arrays in a query string is the wrong way to do it. Too many
> things can go wrong.
True. It is not proper way. But if you still want to pass such data using GET
method then you can build Query string as shown below:
$cartStr='cart[0]=val1&cart[1]=val2'; // assuming that array keys are
numeric.
You can take advantage of the mechanism in PHP that's used to use
arrays in forms:
<?php
$cart = array('item one','item two','item three');
$urlstr = 'gallery.php?final[]=' . implode('&final[]=',$cart);
echo '<a href="' . $urlstr . '">Go</a>';
?>
Then in gallery.php
<?php
if (isset($_GET['final']))
echo implode("<br>\n",$_GET['final']);
?>
Ken
_______________________________________________
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