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
  1. #1
    Regular Coder
    Join Date
    Sep 2007
    Posts
    238
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Append parameters (offset) to URL?

    I currently working on pagination for my search results page.
    I'm trying to figure out how to append the generated offset to the URL

    I need to somehow gather the existing URL and add the offet to the end.
    However there are other complications like if offet already exists in the URL and whether a "?" or "&" is required.

    Does a function in PHP exist to handle this?

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,862
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Take a look at http_build_query()
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Regular Coder
    Join Date
    Sep 2007
    Posts
    238
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Thanks abduraooft.
    Looking at the info I planned to do the following:

    1) $_GET each each parameter and store into separate variables
    2) Do the escapes and validation on each
    3) put into http_build_query()

    Does the above sound correct?

  • #4
    Regular Coder
    Join Date
    Sep 2007
    Posts
    238
    Thanks
    9
    Thanked 0 Times in 0 Posts
    My initial problem with http_build_query() is that I'm passing checkbox arrays so I'm getting:

    Code:
    http://mysite/results.php?keyword=hello&form=Submit&Param1=Arrayoffset=20
    Is there a way around this?
    Last edited by htcilt; 02-08-2010 at 03:51 PM.


  •  

    Posting Permissions

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