SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Evangelist N9ne's Avatar
    Join Date
    Aug 2002
    Location
    UK
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I append something onto the current url (including file name)

    Right, my scenario:

    I am on a page:

    http://mydomain.com/website/index.php?page=testpage

    On this page, there is a link which goes to:

    http://mydomain.com/website/index.ph...s&poll_ident=1

    Now what I want to do, is append:

    action=results&poll_ident=1

    to:

    index.php?page=testpage

    so it reads:

    index.php?page=testpage&action=results&poll_ident=1

    How would I go about 'appending' that onto the current url+filename?

    Thanks in advance for any help.

  2. #2
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    PHP Code:
    echo $_SERVER['REQUEST_URI'].'&action=results&poll_ident=1'

  3. #3
    SitePoint Evangelist N9ne's Avatar
    Join Date
    Aug 2002
    Location
    UK
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I see, it's that simple?!

    So i'm guessing that

    PHP Code:
    $_SERVER['REQUEST_URI'
    ...in PHP just means the requested url that appears in the address bar?

  4. #4
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Not entirely, it mean the preceding slash, the filename and any variables in the querystring. Like

    http://www.somesite.com/dir1/file.php?var1=a&var2=b

    It's URI is

    /file.php?var1=a&var2=b


  5. #5
    SitePoint Evangelist N9ne's Avatar
    Join Date
    Aug 2002
    Location
    UK
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well that's good enough for me. I love learning little things at a time in PHP, thanks for the help .

  6. #6
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    $new_url $_SERVER['HOST_NAME'] . $_SERVER['REQUEST_URI'] . '&action=results&poll_ident=1'
    will include the domain name too.
    Mike
    It's not who I am underneath, but what I do that defines me.


Bookmarks

Posting Permissions

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