append php form URL

五迷三道 提交于 2020-01-06 07:19:26

问题


I currently built a simple form to GET request someones zipcode.

<form action="http://example.com" method="get" target="_blank">
	
	<p>ZIPCODE</p>
	
	<input type="text" name="zip">
	
	<input type="submit" value="Submit">

</form>

When submitted it will be http://example.com/?zip=ZIPCODE

What I am looking to do it add an additional piece so it will be http://example.com/?zip=234&country=usa

I tried adding a hidden field <input type="hidden" name="country=usa"></input> but this replaces = with %3D and adds = after it like so: http://example.com/?zip=ZIPCODE&country%3Dusa=

How can I easily append the URL with country=usa?


回答1:


Try:

<form action="http://example.com" method="get" target="_blank">

    <p>ZIPCODE</p>

    <input type="text" name="zip">

    <input type="hidden" name="country" value="usa">

    <input type="submit" value="Submit">

</form>


来源:https://stackoverflow.com/questions/47944471/append-php-form-url

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!