wkilc Posted August 31, 2010 Share Posted August 31, 2010 This script will clear the old limit value from the URL query: <?php //remove any old limits from query $tmp = array(); foreach ($_GET as $fld => $val) if ($fld != 'limit') $tmp[] = $fld . '=' . $val; $page_name = $_SERVER['SCRIPT_NAME'] . '?' . implode('&',$tmp); ?> <form> <select"> <option value="<? echo "$page_name" ?>&start=0&limit=25">25 records per page</option> <option value="<? echo "$page_name" ?>&start=0&limit=50">50 records per page</option> <option value="<? echo "$page_name" ?>&start=0&limit=100">100 records per page</option> </select> </form> How can I get it to clear BOTH the start and the limit values in the URL? Thank you. ~Wayne Quote Link to comment Share on other sites More sharing options...
jayarsee Posted August 31, 2010 Share Posted August 31, 2010 Sorry, I hope it's not annoying to sidestep your original question, but the design of this (perhaps for reasons I'm not aware of) doesn't seem correct. If you're trying to solve the problem of 1 option tag having to represent multiple values, why not just do this: <input type='hidden' name='start' value='0'> <option name='filter' value='25'>25 Per</option> Or if you really need to combine them: <option name='filter' value='0:25'>25 Per</option> And then just explode by : once it gets to PHP? Quote Link to comment Share on other sites More sharing options...
wkilc Posted August 31, 2010 Author Share Posted August 31, 2010 Thanks. The idea is I want to keep all the other values in the URL while getting rid of the redundant "start". www.mysite.com?name=smith&subject=movies&start=0&limit=50 When I use the form to filter it to 100 results per page, I want to purge both the start and the limit values to avoid this: www.mysite.com?name=smith&subject=movies&start=0&start=0&limit=100 Thank you. ~Wayne Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.