When you look at PHP you can get to the URL vars in a loop like this

<?php
while ($urlVar = each($_GET))
        {
        for ($i=0; $i < count($urlVar); ++$i)
                {
                echo $urlVar["key"]. " item $i = $urlVar[$i]<br>";
                }
        }
?>

If you wanted to, PHP actually parses URL scoped vars with the same name as
an array, which I think is actually better then the list that CF gives you.
I mean whats easier?  ListGetAt(URL.urlVar,2) or URL["urlVar][1]?

Also, PHP actually gives you each item even if the value is empty.

Just say you have this as a URL string

?bla=&bla=&bla=&bla=&bla=

CF will give you URL.bla = ",,,,"
PHP will give you an array of bla but the elements will be empty so you can
go count(@$_GET["bla"]) and it will give you 5.
Do a ListLen(URL.bla) and it will give you 0

This is in PHP 4.0.1 mind you

So there you go

bit of usless info for your friday

Regards
Steve Onnis

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Lindsay
Evans
Sent: Friday, February 20, 2004 11:51 AM
To: CFAussie Mailing List
Subject: [cfaussie] RE: PHP Get URL value [WAS: Weird CFMX 6.0 error]


[EMAIL PROTECTED] wrote:
> The specific example one of the PHP guys gave was extracting the URL
> vars from a multiple select form. As the URL search string would read:
>
> attribute=1&attribute=2&attribute=3
>
> He was saying he would need to set up a loop because
> @GET["attribute"] would just return the last value - "3".
>
> Whereas CF must automatically parse this as URL.attribute would
> be a list of
> {1,2,3}

You can send form elements as arrays in PHP:
<http://au.php.net/manual/en/faq.html.php#faq.html.arrays>

So:

<select name="foo[]" multiple="multiple">
 <option value="1">One</option>
 <option value="2">Two</option>
 <option value="3">Three</option>
</select>

Would translate into this in PHP if you selected 'One' and 'Three':

$_POST['foo'][0] = 1;
$_POST['foo'][1] = 3;


--
 Lindsay Evans.
 Developer,
 Red Square Productions.

 [p] 8596.4000
 [f] 8596.4001
 [w] www.redsquare.com.au


---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004


---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to