On Tuesday 01 Jul 2008 19:35:47 chad qian wrote: > Thanks for everyone answer my question! > > One further question: > if > url=galleryform.php?$cartStr='cart[0]=val1&cart[1]=val2'; > > then > On gallery.php page: > <?php$totalcart=new array() > $totalcart=$_GET['cartStr'] > for($x=0;$x<$totalcart[].length;$x++) > {echo $totalcart[$x]; > } ?>
foreach{} is better than this. Study PHP manual about how to implement it. Anirudh Zala > > Is gallery.php coding is correct?I want to output array. > > Thanks again! > > > Date: Tue, 1 Jul 2008 06:24:17 -0400> To: talk@lists.nyphp.org> From: > > [EMAIL PROTECTED]> Subject: Re: [nyphp-talk] url pass array as > > parameter> > 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 > > _________________________________________________________________ > It’s a talkathon – but it’s not just talk. > http://www.imtalkathon.com/?source=EML_WLH_Talkathon_JustTalk _______________________________________________ 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