从第二种形式传递第二个参数?
I'm using laravel 5.4
, my question is how can I pass a second parameter from a different form.
I know when I have multiple inputs in the same form I can pass multiple parameters
<form action="" method="get">
<input type="text" name="country" placeholder="country">
<input type="text" name="town" placeholder="town">
</form>
If I search here I would get something like website.com/?country=croatia&town=zagreb
but how can I get the same result but from two forms
<form action="" method="get">
<input type="text" name="country" placeholder="country">
</form>
<form action="" method="get">
<input type="text" name="town" placeholder="town">
</form>
I need to be able to search one form, and then the second if I want lets say I search for a country first and I get
website.com/?country=croatia
and now I want to search also for a town and I get
website.com/?country=croatia&town=zagreb
It should work the other way around!(If I search for a town first and the a country second. I know that this is a bad example)
我正在使用 我知道当我有多个相同形式的输入时,我可以传递多个参数 p>
如果我在这里搜索,我会得到像
website.com/?country = croatia&amp; town = zagreb
但如何从两种形式获得相同的结果 p>
我需要能够搜索一个表单, 然后第二个,如果我想
lets说我搜索国家fi rst,我得 p>
现在我想搜索一个 小镇,我得到了 p>
它应该适用于其他人 四处寻找!(如果我首先搜索一个城镇,然后搜索一个国家/地区。 我知道这是一个不好的例子) p>
div> laravel 5.4 code>,我的问题是如何传递第二个参数 来自不同的形式。 p>
&lt; form action =“”method =“get”&gt;
&lt; input type =“text”name =“country”placeholder =“country”&gt;
&lt; input type =“text”name =“town”placeholder =“ town“&gt;
&lt; / form&gt;
code> pre>
&lt; form action =“”method =“get”&gt;
&lt; input type =“text”name =“country”placeholder =“country”&gt;
&lt; / form&gt;
&lt; form action =“”method =“get”&gt;
&lt; input type =“text”name =“town”placeholder =“town”&gt;
&lt; / form&gt;
code> pre>
website.com/?country=croatia code> p>
website.com/?country=croatia&town=zagreb code> p>
A bit complicated what you are trying to do. But there are some workarounds.
Your first form
<form action="" method="get">
<input type="text" name="country" placeholder="country">
</form>
Your second form
<form action="" method="get">
<input type="hidden" name="country" value="{{ request('country') }}">
<input type="text" name="town" placeholder="town">
</form>
When you submit the second form, it will actually recreate the URL by taking the values from the URL. At the end of the day, you have your second form "adding" parameters to the URL.