Skip to main content
Inspiring
November 11, 2008
Question

PHP: URL variable that is unnamed

  • November 11, 2008
  • 5 replies
  • 1184 views
Suppose I have

<a href="foo.php/?foo"

How would I get at that URL variable?

If I print_r($_GET), I just get an array....

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
==================


This topic has been closed for replies.

5 replies

Inspiring
November 12, 2008
On Tue, 11 Nov 2008 13:08:17 -0500, "Murray *ACE*"
<forums@HAHAgreat-web-sights.com> wrote:

>Suppose I have
>
><a href="foo.php/?foo"
>
>How would I get at that URL variable?

Not sure exactly what you want, but perhaps this will get you started:

parse_str($_SERVER['QUERY_STRING'],$params);
foreach($params as $key=>$value){
print "$key=$value<br>\n";
}

Of course, it goes without saying that you need to validate the passed
parameters very carefully.

Gary
Inspiring
November 11, 2008
Thanks, Mick - that's a way I hadn't thought of.

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
==================


"Michael White" <mwhite13@rochester.rr.com> wrote in message
news:gfck2k$fqr$1@forums.macromedia.com...
> Murray *ACE* wrote:
>> Suppose I have
>> <a href="foo.php/?foo"
>>
>> How would I get at that URL variable?
>>
>> If I print_r($_GET), I just get an array....
>>
> js:
>
> location.search.substring(1)
>
> Mick

Inspiring
November 11, 2008
Murray *ACE* wrote:
> Suppose I have
> <a href="foo.php/?foo"
>
> How would I get at that URL variable?
>
> If I print_r($_GET), I just get an array....
>
js:

location.search.substring(1)

Mick
Inspiring
November 11, 2008
Ahhhh! Thanks.

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
==================


"David Powers" <david@example.com> wrote in message
news:gfchr4$crv$1@forums.macromedia.com...
> Murray *ACE* wrote:
>> Suppose I have
>> <a href="foo.php/?foo"
>>
>> How would I get at that URL variable?
>
> $_SERVER['QUERY_STRING']
>
> --
> David Powers, Adobe Community Expert
> Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
> Author, "PHP Solutions" (friends of ED)
> http://foundationphp.com/

Inspiring
November 11, 2008
Murray *ACE* wrote:
> Suppose I have
> <a href="foo.php/?foo"
>
> How would I get at that URL variable?

$_SERVER['QUERY_STRING']

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/