Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

PHP: URL variable that is unnamed

LEGEND ,
Nov 11, 2008 Nov 11, 2008
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
==================


TOPICS
Server side applications
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 11, 2008 Nov 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/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 11, 2008 Nov 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/

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 11, 2008 Nov 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 11, 2008 Nov 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 11, 2008 Nov 11, 2008
LATEST
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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines