Php 从第二个表单传递第二个参数?
我使用的是Php 从第二个表单传递第二个参数?,php,laravel,Php,Laravel,我使用的是Laravel5.4,我的问题是如何从不同的表单传递第二个参数 我知道当我有多个相同形式的输入时,我可以传递多个参数 <form action="" method="get"> <input type="text" name="country" placeholder="country"> <input type="text" name="town" placeholder="town"> </form> 如果我在这里搜
Laravel5.4
,我的问题是如何从不同的表单传递第二个参数
我知道当我有多个相同形式的输入时,我可以传递多个参数
<form action="" method="get">
<input type="text" name="country" placeholder="country">
<input type="text" name="town" placeholder="town">
</form>
如果我在这里搜索,我会得到
website.com/?country=克罗地亚&town=萨格勒布
但是我怎么能从两种形式得到相同的结果呢
<form action="" method="get">
<input type="text" name="country" placeholder="country">
</form>
<form action="" method="get">
<input type="text" name="town" placeholder="town">
</form>
我需要能够搜索一个表单,然后第二个如果我想
假设我先搜索一个国家,然后
website.com/?country=克罗地亚
现在我还想搜索一个城镇
website.com/?country=克罗地亚&town=萨格勒布
它应该反过来工作!(如果我先搜索一个城镇,然后搜索另一个国家。我知道这是一个糟糕的例子)你想做的事情有点复杂。但也有一些变通办法 你的第一张表格
<form action="" method="get">
<input type="text" name="country" placeholder="country">
</form>
你的第二份表格
<form action="" method="get">
<input type="hidden" name="country" value="{{ request('country') }}">
<input type="text" name="town" placeholder="town">
</form>
当您提交第二个表单时,它实际上会通过从URL获取值来重新创建URL。在一天结束时,您将有第二个表单向URL“添加”参数