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

    $_GET isn't capturing all values

    Am working on a fairly complicated script.

    I just added this sort drop-down...
    PHP Code:
        <!-- Sort Menu -->
        <div class="drop">
            <label for="sortrequest">Sort by:</label>
            <select name="sortrequest">
                <option value="by-date-desc" <?php echo (($sortRequest=='by-date-desc') ? ' selected="selected"' ''?>>Date (Newest 1st)</option>
                <option value="by-date-asc" <?php echo (($sortRequest=='by-date-asc') ? ' selected="selected"' ''?>>Date (Oldest 1st)</option>
            </select>

            <!-- Submit Button -->
            <input type='submit' name='submit' value='Go'/>
        </div><!-- End of SORT MENU -->

    Then I added this code to the top of my script...
    PHP Code:
    var_dump($_GET);
    exit(); 

    Next, I then took these actions...

    1.) Comment out var_dump($_GET) and exit().
    2.) Run script
    3.) Choose "Sort by Date (Asc)" in the Form
    4.) Uncomment var_dump($_GET) and exit() in my script
    5.) THEN click "Go" on the Form


    After my script runs, I see this in the URL...
    Code:
    http://local.debbie/finance/tax-season/5-tax-shelters-you-need-to-know?sortrequest=by-date-asc&submit=Go

    And PHP displays the following...
    Code:
    array (size=3)
      'section' => string 'finance' (length=7)
      'subsection' => string 'tax-season' (length=10)
      'article' => string '5-tax-shelters-you-need-to-know' (length=31)

    How is it possible that the URL gets updated with the Form value I chose, BUT var_dump($_GET) isn't showing anything for 'sortrequest'??

    Sincerely,


    Debbie

  • #2
    Regular Coder
    Join Date
    Oct 2004
    Posts
    363
    Thanks
    0
    Thanked 18 Times in 18 Posts
    Add QSA (Query String Append) to your mod_rewrite flags (ie. [QSA,L] instead of just [L]).

  • #3
    Senior Coder doubledee's Avatar
    Join Date
    Mar 2011
    Location
    Arizona
    Posts
    1,108
    Thanks
    27
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by schleppel View Post
    Add QSA (Query String Append) to your mod_rewrite flags (ie. [QSA,L] instead of just [L]).
    Can I kiss you?!

    Gee, and I just learned about QSA earlier this week.

    Sadly, I placed it in my Subsection Mod_rewrite and didn't even think to place it in my Article mod_rewrite as well?!

    Wow, you really came to my rescue!!!

    Thank you!!

    Sincerely,


    Debbie


  •  

    Posting Permissions

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