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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.