SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast Jujubee's Avatar
    Join Date
    Mar 2001
    Location
    Canada
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've got table which I want to filter by category and then sort via name, date, etc.

    So my query string is something like

    ?category=RED&sort=NAME

    The sort links I'm using now add " &sort=???? " to the current $REQUEST_URI.

    The problem is everytime I click on a sort, the query string increases because the "name=" is appended instead of replacing the one that's currently there. So it ends up looking like:

    ?category=RED&sort=NAME&sort=DATE&sort=NAME&sort=DATE


    Now I figure I can get around this by parsing HTTP_GET_VARS, and checking for duplicate variables, but it gets messy since HTTP_GET_VARS is an array.


    MY QUESTION: is there a simpler way to replace the GET variables?

    Once again, thanks guys - the Sitepoint forum are great!

  2. #2
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    While you add something to the $REQUEST_URI? Is there any specific reason for doing this?

    If you want to replace the old value, I'd reconstruct the link again and use the new value instead
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  3. #3
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    eh?

    Can you provide the code which has the self=referencing link?

  4. #4
    SitePoint Enthusiast Jujubee's Avatar
    Join Date
    Mar 2001
    Location
    Canada
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh, thanks for trying guys, but I must have had a lapse of reasoning there. I was trying to find some convoluted way of recontructing the query variables when all I had to do is reference them by their names. I was thinking associative arrays, and all kinds of other stuff. I keep missing the easy solution!


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
  •