Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 添加其他筛选器时保存限制更改_Php_Jquery_Joomla_Get - Fatal编程技术网

Php 添加其他筛选器时保存限制更改

Php 添加其他筛选器时保存限制更改,php,jquery,joomla,get,Php,Jquery,Joomla,Get,我在这里迷路了,需要建议。我的情况:使用以下代码,我更改模块中的默认项目限制: <form method="get" style="text-align:center;"> <input type="hidden" name="lastrecepes" value=""> <button type="submit" value="24" id="limit" name="limit" onclick="chan

我在这里迷路了,需要建议。我的情况:使用以下代码,我更改模块中的默认项目限制:

<form method="get" style="text-align:center;">
            <input type="hidden" name="lastrecepes" value="">
                <button type="submit" value="24" id="limit" name="limit" onclick="change();" style="width:200px;margin:20px 0 20px 0;"/>change limit</button>
                <script>
                function change(){
                var elem = document.getElementById("limit");
                if (elem.value=="24") elem.value = "36";}
                </script>

            </form>
我的链接更改为:http://project/?lastrecepes=&limit=36 它可以工作,但当我尝试添加另一个过滤器时,如:

<button type="submit" value="0" id="skip_items" name="skip_items" onclick="change1();" style="width:200px;margin:20px 0 20px 0;"/>more</button><script>
                function change1(){
                var elem = document.getElementById("skip_items");
                if (elem.value=="0") elem.value = "15";}
                </script>
更多
函数change1(){
var elem=document.getElementById(“跳过项”);
如果(elem.value==“0”)elem.value=“15”;}
它将限制更改为旧值,url如下所示:http://project/?lastrecepes=&skip_items=15

如果我手动将它们添加到一起,它们可以正常工作:http://project/?lastrecepes=&limit=36&skip_items=15


有人能帮我吗?我想在另一个过滤器出现时保存第一个过滤结果。对不起,我的英语不好,希望你能理解我。

当然,当你刷新页面时,限制将从36变回24,因为你没有在任何地方保存更改。如果转到http://project/?lastrecepes=&skip_items=15,则限制为24,因为这是默认值


您需要做的是在更改限制时将其保存到cookie或会话(取决于您的需要),然后在每次页面加载时检查cookie/会话以获取当前限制值。

这会这么难吗?一号知道?!好的,我明白了,有没有机会给我举个例子,如何做到这一点?对不起,这需要一些时间,我无法投资。请在谷歌上搜索PHP cookies并自己尝试。如果你对它一点也不熟悉,可能需要几个小时。
<button type="submit" value="0" id="skip_items" name="skip_items" onclick="change1();" style="width:200px;margin:20px 0 20px 0;"/>more</button><script>
                function change1(){
                var elem = document.getElementById("skip_items");
                if (elem.value=="0") elem.value = "15";}
                </script>