Reply to Re: newbie prob with splitting QUERY_STR

Your name:

Reply:


Posted by steve on 11/29/05 04:48

you can try preg_match() to put the label/value pairs in an array using...

[?&]([^=]*)=([^?&\n]*)

the first grouping:

([^=]*)

gives you the label(s)

the second grouping:

([^?&\n]*)

gives you the respective value(s)

i'm not going to coach you through the rest as preg is covered extensively
in php documentation.

hth,

me

btw...you can turn the labels into variables like name to $name or address1
to $address1 by enumerating the first grouping and using $$ on the values in
that array...this is also well documented. i must say though, if you know
what to expect from your query string, this is certainly an obtuse way of
approaching a solution.



"newbie" <newbie@home.net> wrote in message
news:dmgbi3$cb3$1@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
| Hi,
|
| I have a form that returns
|
| $_ENV[QUERY_STRING]=name=bob&address1=house&address2=town
|
| I want to be able to split this to end up with separate values like..
|
| $name = bob
| $address1 = house
| $address2 = town
|
| but can't figure out how.
| I'm sure this is very basic and so would be glad of any help
|
| thanks
|
|
|
|

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация