select option clears when page loads in php

Posted by user79685 on Stack Overflow See other posts from Stack Overflow or by user79685
Published on 2010-02-19T09:54:46Z Indexed on 2010/03/17 15:21 UTC
Read the original article Hit count: 264

Filed under:
|
|
|
|

Hey guys,

the scenario is this: see select below

<form name="limit">
    <select name="limiter" onChange="limit(this.value)">
        <option selected="selected">&nbsp;</option>
        <option value="5">5</option>
        <option value="10">10</option>
        <option value="15">15</option>
    </select>
</form>

I want whenever any option is selected for 3 things to happen:

1.) js limit() function is called which all it does its takes current url, adds new query parameter 'limit' with the user selected value eg:

http://localhost/blahblah/apps/category.php?pg=1&catId=3021&limit=5

(this will cause the category.php page to be hit and # of product displayed limited to the value selected by user)

2.)Once the url is hit, it reloads but i DONT want the value selected to reset back to the default (which it currently does). I want it to reflect the users selection after page reload.

3.) Also, when i move to the next page (pagination), i would like the state to be carried ova to the next page (ie. remembering the user selection).

© Stack Overflow or respective owner

Related posts about php

Related posts about select