表单清除给定操作url中的参数-PHP Laravel

表单清除给定操作url中的参数-PHP Laravel,php,html,laravel,Php,Html,Laravel,但当我提交搜索表单时,它会重定向到: http://127.0.0.1:8080/people/search/customers?countries=Germany&statuses=3&page=1 而不是包括以前设置的参数 有什么方法可以防止这种情况发生吗?我所做的是将前面的参数作为隐藏字段添加: http://127.0.0.1:8080/people/search/customers?search=test @foreach(request()->query()作为$

但当我提交搜索表单时,它会重定向到:

http://127.0.0.1:8080/people/search/customers?countries=Germany&statuses=3&page=1
而不是包括以前设置的参数


有什么方法可以防止这种情况发生吗?

我所做的是将前面的参数作为隐藏字段添加:

http://127.0.0.1:8080/people/search/customers?search=test
@foreach(request()->query()作为$key=>$value)
@if($key==“page”)//不希望页面参数在其中
@继续
@恩迪夫
@endforeach

可以通过使用
$\u会话
。知道怎么做吗?我可以给你写一个例子。@RonnieOosting我不想使用会话来处理我需要的内容按钮缺少type=“submit”或任何js点击捕获?在表单中,只有一个输入name=“search”,那么有什么不对,第一个url?countries=Germany&statuses=3&page=1所有查询字符串来自何处?是的,您不能混合查询字符串和表单参数。@Devon您是在谈论我在问题或答案中所做的事情吗?我是在谈论这个解决方案工作的原因。如果有表单输入,则不能在get请求的表单操作上使用查询字符串。
http://127.0.0.1:8080/people/search/customers?search=test
@foreach(request()->query() as $key => $value)
    @if($key == "page") // Don't want the page parameter to be in there
        @continue
    @endif
    <input type="hidden" name="{{$key}}" value="{{$value}}">
@endforeach