append php form URL

2019-08-23 03: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?

标签: php forms get
1条回答
男人必须洒脱
2楼-- · 2019-08-23 04:11

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>
查看更多
登录 后发表回答