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 2 of 2
  1. #1
    Senior Coder doubledee's Avatar
    Join Date
    Mar 2011
    Location
    Arizona
    Posts
    1,064
    Thanks
    25
    Thanked 0 Times in 0 Posts

    Query String questions

    This is going to sound dumb, but I'm not exactly sure how to work with a Query String?! (I'm used to working with "pretty URLs" and mod_rewrites...)


    I have a page that lists article summaries like this...
    Code:
    www.debbie.com/articles/

    I want to make it so a user can choose a sort option in a drop-down menu, click a "Go" button, and the page is reloaded with a URL like this...
    Code:
    www.debbie.com/articles/?sortname=by-rating&sortdir=desc&page=4
    (And article summaries, of course, would now be sorted accordingly)


    Questions:

    1.) How do I build the new URL with the Query String?

    2.) Do I have to change my mod_rewrite - which already handles the pretty URL - to handle the Query String?

    3.) Any security considerations - other than my PHP script has to sanitize the values in the Query String?

    Sincerely,


    Debbie

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    1. Nothing changes. Querystring is handled by the server.
    2. You need to ensure that QSA flag is used if you add non-handled querystring items
    3. Same as any other querystring data.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

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