|
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
|
|
|
|
Navigation:
[Reply to this message]
|