Re: Building an array from a URL

From: Date: Thu, 05 Apr 2001 05:17:32 +0000
Subject: Re: Building an array from a URL
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-47170@lists.php.net to get a copy of this message
Ok - say you have this: $foo = array( 0 => 'joe', 1 => 'stump', 2 => 'there'); while(list($key,$val) = each($foo)) $args[] = 'array['.$key.']='.$val; $url = 'http://www.server.com/script.html'; $url .= '?'.implode('&',$args); header("Location: $url"); exit; That has worked for me before and will most likely work again. --Joe On Wed, Apr 04, 2001 at 09:42:20PM -0400, Mike Gifford wrote: > Hi Joe, > > I don't doubt that at all.. However, my strings aren now looking like this. > > > http://openconcept.ca/rabble/superRSS.phtml?Title%5B1000%5D=RBC+Dominion+Securities+investigates+&URL%5B1000%5D=http%3A%2F%2Fcbc.ca%2Fcgi-bin%2Ftemplates%2Fview.cgi%3F%2Fnews%2F2001%2F04%2F04%2Frbcds_010404&Abstract%5B1000%5D=RBC+Dominion+Securities+said+Wednesday+morning+it+is+launching+an++investigation+of+some+suspicious+trading.+%0D%0A&Title%5B1184%5D=Indigenous+Peoples+Critical+of+The+Human+Genome+Project&URL%5B1184%5D=http%3A%2F%2Fwww.wtowatch.org%2Fwtowatch%2Fnews%2Findex.cfm%3FID%3D2113&Abstract%5B1184%5D=aa&new_superRSS=new_superRSS > > I've got the $Title[1000]=, but it looks like Title%5B1000%5D= > > Also, I'm having trouble extracting arrays from arrays.. I just want to insert > the new values (for articleID 1000, etc.) into a table.. > > Any suggestions? > > Mike > > Joe Stump wrote: > > It works for me in production. > > > > On Wed, Apr 04, 2001 at 08:56:53PM -0400, Mike Gifford wrote: > > > I tried this, but it converted [ and ] to url friendly codes. Does this still > > > work? > > > > > > Mike > > > > > > Joe Stump wrote: > > > > FYI you can send data like this on the url: > > > > > > > > > > > > http://www.foo.com/script.php?test[joe]=stump&test[harry]=bar&test[jane]=scott > > > > > > > > Then $test will be an array that translates to this in PHP: > > > > > > > > <? > > > > > > > > $test = array( > > > > joe => 'stump', > > > > harry => 'bar', > > > > jane => 'scott'); > > > > > > > > ?> > > > > > > > > --Joe > > > > > > > > On Wed, Apr 04, 2001 at 12:00:48PM -0400, Mike Gifford wrote: > > > > > Hello, > > > > > > > > > > I'm trying to build an array out of data submitted from a URL. > > > > > > > > > > Essentially, I want to pull certain records out of a database which have > > > > > been > > > > > selected on another form. > > > > > > > > > > The URL presently looks like this: > > > > > > > > > > superRSS.phtml?150=1150&superRSS166=1166&superRSS168=1168&superRSS175=1188 > > > > > > > > > > I'd like to take these independent variables and merge them into a > > > > > single array: > > > > > $array_superRSS = implode (":", $superRSS[]); > > > > > > > > > > So I can then pipe these values directly into another function: > > > > > > > > > > while ($array_superRSS) { > > > > > display_superRSS($array_superRSS[]); > > > > > } > > > > > > > > > > Obviously I'm missing a step or two here, but would really appreciate > > > > > someone > > > > > filling in some of the gaps. > > > > > > > > > > Thanks! > > > > > > > > > > Mike > > > > > -- > > > > > Mike Gifford, OpenConcept Consulting, > > > > > http://openconcept.ca > > > > > Offering everything your organization needs for an effective web site. > > > > > Featured Client: > > > > > http://www.aboriginalrightscoalition.ca/ > > > > > If a book doesn't make us better, then what on earth is it for? - > > > > > Alice Walker > > > > > > > > > > -- > > > > > PHP General Mailing List (http://www.php.net/) > > > > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > > > > For additional commands, e-mail: php-general-help@lists.php.net > > > > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > > > > /******************************************************************************\ > > > > * Joe Stump - PHP/SQL/HTML Developer * > > > > * http://www.care2.com - > > > > http://www.miester.org - > > > > http://gtk.php-coder.net * > > > > * "Better to double your money on mediocrity than lose it all on a > > > > dream." * > > > > \******************************************************************************/ > > > > > > -- > > > Mike Gifford, OpenConcept Consulting, > > > http://openconcept.ca > > > Offering everything your organization needs for an effective web site. > > > Featured Client: > > > http://www.aboriginalrightscoalition.ca/ > > > If a book doesn't make us better, then what on earth is it for? - Alice Walker > > > > /******************************************************************************\ > > * Joe Stump - PHP/SQL/HTML Developer * > > * http://www.care2.com - > > http://www.miester.org - > > http://gtk.php-coder..net * > > * "Better to double your money on mediocrity than lose it all on a dream." * > > \******************************************************************************/ > > -- > Mike Gifford, OpenConcept Consulting, http://openconcept.ca > Offering everything your organization needs for an effective web site. > Featured Client: http://www.aboriginalrightscoalition.ca/ > If a book doesn't make us better, then what on earth is it for? - Alice Walker /******************************************************************************\ * Joe Stump - PHP/SQL/HTML Developer * * http://www.care2.com - http://www.miester.org - http://gtk.php-coder.net * * "Better to double your money on mediocrity than lose it all on a dream." * \******************************************************************************/

« previous php.general (#47170) next »