如何将表单发送到URL?

时间:2013-09-01 00:27:55

标签: php html

以下是我目前用于表单的代码:

<form method="post" action="access.php" class="form-stacked">

    <fieldset class="control-group">

        <div class="control-group">
            <div class="controls">
                <input class="input-xlarge" name="s1" id="s1" type="text" value="" />
            </div>
          </div>
          <center>(click here if you need help finding your username)</center>

    </fieldset>

    <fieldset class="control-group">

        <div class="control-group">
            <div class="controls">
                <input class="input-xlarge" name="s2" id="s2" type="text" value="" />
            </div>
          </div>
          <center>(click here if you need help finding your username)</center>

    </fieldset>

</form>

当我点击输入时,它会直接将人们带到http://mysite.com/access.php

但我试图找出如何将它们带到http://mysite.com/access.php?s1=value&s2=value

显然,该值将替换为实际输入的文本。对我来说,更改此代码以实现它的最简单方法是什么?

谢谢!

3 个答案:

答案 0 :(得分:2)

答案 1 :(得分:0)

method="POST"method="GET"
多数民众赞成

答案 2 :(得分:0)

以下代码应该可以正常工作。但请注意,如果用户输入密码,信用卡信息等敏感数据,则不应执行此操作

<form method="get" action="access.php" class="form-stacked">

<fieldset class="control-group">

    <div class="control-group">
        <div class="controls">
            <input class="input-xlarge" name="s1" id="s1" type="text" value="" />
        </div>
      </div>
      <center>(click here if you need help finding your username)</center>

</fieldset>

<fieldset class="control-group">

    <div class="control-group">
        <div class="controls">
            <input class="input-xlarge" name="s2" id="s2" type="text" value="" />
        </div>
      </div>
      <center>(click here if you need help finding your username)</center>

</fieldset>