Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: $_server

  1. #1
    New Coder
    Join Date
    Feb 2009
    Posts
    96
    Thanks
    8
    Thanked 0 Times in 0 Posts

    $_server

    Hey,
    Is there something where I can get the full file?
    For example, the URL is: xx/xxx/xx/x.php
    I want: /file.php?action=x&do=x
    $_SERVER['REQUEST_URI'] works, but it leaves anything after & out.

    Can you help me?
    Thanks!

  • #2
    Senior Coder kbluhm's Avatar
    Join Date
    Apr 2007
    Location
    Philadelphia, PA, USA
    Posts
    1,509
    Thanks
    3
    Thanked 258 Times in 254 Posts
    $_SERVER also contains a key call QUERY_STRING:
    PHP Code:
    $full_uri $_SERVER['REQUEST_URI'];

    if ( ! empty( 
    $_SERVER['QUERY_STRING'] ) )
    {
        
    $full_uri .= '?' $_SERVER['QUERY_STRING'];
    }

    echo 
    $full_uri

  • #3
    Regular Coder ninnypants's Avatar
    Join Date
    Apr 2008
    Location
    Utah
    Posts
    504
    Thanks
    10
    Thanked 47 Times in 47 Posts
    you can use $_SERVER['QUERY_STRING'] to get everything after the ?

  • #4
    New Coder
    Join Date
    Feb 2009
    Posts
    96
    Thanks
    8
    Thanked 0 Times in 0 Posts
    That works, but again it only gets ?action=X. I need it to also get anything after &.
    EDIT: Never mind, it works!
    thanks!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •