Jump to content

delete old values


wkilc

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/212218-delete-old-values/
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/212218-delete-old-values/#findComment-1105820
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/212218-delete-old-values/#findComment-1105826
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.