Re: passing vars. betn. php and javascript

From: Date: Fri, 26 Apr 2002 18:58:18 +0000
Subject: Re: passing vars. betn. php and javascript
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-94784@lists.php.net to get a copy of this message
Great! It works fine. Thanks to Kevin, Erik, Miguel and all others who responded to this query since yesterday. I have $QUERY_STRING in my php 4.0.6. On Fri, 26 Apr 2002, Kevin Stone wrote: > Okay I'm beginning to understand. I don't think you have to use Javascript > in this situation you jsut have to be a little clever about how you build > your URL string. You can send an array through the URL by splitting up each > value like this.. > > $url = > 'http://www.domain.com/index.php?myarray[]='.$myarray[0]; > for ($i=1; $i<count($myarray); $i++) > { > $url .= '&myarray[]='.$myarray[$i]; > } > header("Location: $url"); > > You will get $_GET[myarray] on the other side. OR you can do a single comma > or semicolon delimited string and then explode(',' $myarray) on the other > end to reconstitue the array. Hope that helps. > > -Kevin > > ----- Original Message ----- > From: "Pushkar Pradhan" <pushkar@ERC.MsState.Edu> > To: "Leotta, Natalie (NCI/IMS)" <LeottaN@ims.nci.nih.gov> > Cc: <php-general@lists.php.net> > Sent: Friday, April 26, 2002 12:10 PM > Subject: RE: [PHP] passing vars. betn. php and javascript > > > > Actually I was frustrated trying to redirect to a new page and not being > > able to pass the array along to the new page usign header(), I won't get > > the array in my new page. Also I thought JS would be faster since the > > client can submit after doing as many reorderings as he/she wants. > > > > > Is there any reason that you have to use JS to redo the array? I did > > > something like this once and had the buttons monitored by JS, then when > you > > > click it set a hidden var (with a name like sort) and submitted the > page. > > > Then my PHP read in everything and redrew the graph based on what we > were > > > sorting by. It wasn't as difficult as it sounds - the only problem was > they > > > decided that it wasn't pertinent to that graph, so we aren't using it > > > anymore. I don't know if I have any of the code left. > > > > > > -Natalie > > > > > > -----Original Message----- > > > From: Jason Wong [mailto:php-general@gremlins.com.hk] > > > Sent: Friday, April 26, 2002 1:46 PM > > > To: php-general@lists.php.net > > > Subject: Re: [PHP] passing vars. betn. php and javascript > > > > > > > > > On Saturday 27 April 2002 01:23, Pushkar Pradhan wrote: > > > > In my php I had 4 buttons, up, down, top and bottom: > > > > After detecting which element and which button was clicked I changed > > > > the element position by using array_slice, shift, unshift, array_merge > > > > etc.. I'm not sure what I'll do it JS > > > > > > Well, depending on how you were reordering the array I was going to > suggest > > > you use php. Since you already have a version in php and you want to do > it > > > in > > > javascript then ... > > > > > > > > > I've never written javascript? Thanks, > > > > > > I suggest you learn some javascript then think about how to "pass an > array" > > > to it from php :) > > > > > > -- > > > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > > > Open Source Software Systems Integrators > > > * Web Design & Hosting * Internet & Intranet Applications Development * > > > > > > /* > > > The profession of book writing makes horse racing seem like a solid, > stable > > > business. > > > -- John Steinbeck > > > [Horse racing *is* a stable business ...] > > > */ > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -Pushkar S. Pradhan > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -Pushkar S. Pradhan

« previous php.general (#94784) next »