附加php表单URL

时间:2017-12-22 16:19:33

标签: php forms get

我目前为GET请求构建了一个简单的表单,其中包含一些zipcode。



<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<div class="fixed-side-navbar">
  <ul class="nav">
    <li><a href="#example-one"><span>Example One</span></a></li>
    <li><a href="#example-two"><span>Example Two</span></a></li>
    <li><a href="#example-three"><span>Example Three</span></a></li>
    <li><a href="#example-four"><span>Example Four</span></a></li>
    <li><a href="#example-five"><span>Example Five</span></a></li>
    <li><a href="#example-six"><span>Example Six</span></a></li>
  </ul>
</div>
<div id="example-one"></div>
<div id="example-two"></div>
<div id="example-three"></div>
<div id="example-four"></div>
<div id="example-five"></div>
<div id="example-six"></div>
&#13;
&#13;
&#13;

提交后,它将是<form action="http://example.com" method="get" target="_blank"> <p>ZIPCODE</p> <input type="text" name="zip"> <input type="submit" value="Submit"> </form>

我想要做的是添加一个额外的部分,因此它将是http://example.com/?zip=ZIPCODE

我尝试添加隐藏字段http://example.com/?zip=234&country=usa,但这会将<input type="hidden" name="country=usa"></input>替换为=,并在其后添加%3D=

如何轻松地使用country = usa?

附加网址

1 个答案:

答案 0 :(得分:4)

尝试:

<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>