Re: [PHP] passing array of variables in a query string

2002-03-01 Thread Richard Baskett

If you have control over the query string, just name your variable 'state[]'
and then when it is passed through the query string as:

http://www.archipro.com/test.php?state[]=AB&state[]=BC

PHP will see that it is an array and will parse it as such and you can
access the variables as an array.

Cheers!

Rick

"We should be taught not to wait for inspiration to start a thing.  Action
always generates inspiration.  Inspiration seldom generates action." - Frank
Tibolt

> - Original Message -
> From: "Diana Castillo" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, March 01, 2002 6:42 PM
> Subject: [PHP] passing array of variables in a query string
> 
> 
> I was wondering if someone could help me
> with this:
> what I need to know is how to pick up an array of variables from
> a query string such as:
> http://www.archipro.com/test.php?state=AB&state=BC
> If I use $state, I get only the last one.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] passing array of variables in a query string

2002-03-01 Thread Kevin Stone

To form an array of values in the GET string append brackets to the end
of each variable name...

http://www.archipro.com/test.php?state[]=AB&state[]=BC

for($i=0; $i";
}

Result:
AB
BC

Hope this helps.  :)

-Kevin

-Original Message-
From: Diana Castillo [mailto:[EMAIL PROTECTED]] 
Sent: Friday, March 01, 2002 9:42 AM
To: [EMAIL PROTECTED]
Subject: [PHP] passing array of variables in a query string

I was wondering if someone could help me
with this:
 what I need to know is how to pick up an array of variables from
 a query string such as:
 http://www.archipro.com/test.php?state=AB&state=BC
 If I use $state, I get only the last one.




-- 
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




Re: [PHP] passing array of variables in a query string

2002-03-01 Thread Andrey Hristov

It is in the TODO list of PHP. The behaviour will be changed in such a case.
You can get the string from $QUERY_STRING
explode it with $ar=explode('&',$QUERY_STRING);
and some other small things to get all stuff with same name in an array

Regards,
Andrey
- Original Message - 
From: "Diana Castillo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 01, 2002 6:42 PM
Subject: [PHP] passing array of variables in a query string


> I was wondering if someone could help me
> with this:
>  what I need to know is how to pick up an array of variables from
>  a query string such as:
>  http://www.archipro.com/test.php?state=AB&state=BC
>  If I use $state, I get only the last one.
> 
> 
> 
> 
> -- 
> 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