【问题标题】:Why is this form making the fields and variables part of the process form?为什么此表单将字段和变量作为流程表单的一部分?
【发布时间】:2011-12-02 23:04:34
【问题描述】:

我正在这样做:

  <form action="processform.php" type="post">
  <input type="text" name="sample">
  <input type="text" name="how">
  <input type="checkbox" name="fields" value="fields">Something</input>
  </form>

点击提交按钮后,流程页面地址栏显示如下:

  https://www.domain.com/processform.php?sample=&how=&fields=

【问题讨论】:

  • 你能显示你的processform.php吗?你在那里使用 $_GET 吗?
  • 正如答案所说,您应该将其更改为 method="post"。默认情况下,from 方法是 GET - 因此地址栏中的字段。

标签: php forms variables post process


【解决方案1】:

更改为&lt;form method="post" /&gt;

【讨论】:

    【解决方案2】:

    首先将type="post" 更改为method="post"

    【讨论】:

      【解决方案3】:

      method 属性指定了提交类型(例如“get”或“post”),但您使用了type 属性……这是不正确的。你需要这样的东西:

      <form action="processform.php" method="post">
       <input type="text" name="sample">
       <input type="text" name="how">
       <input type="checkbox" name="fields" value="fields">Something</input>
      </form>
      

      【讨论】:

        【解决方案4】:

        你的标记是错误的

        试试

        <form action="processform.php" method="post">
           <input type="text" name="sample" value='VALUE' />
           <input type="text" name="how" value='VALUE' />
        
           <label for='fields'>Something</label>
           <input id='fields' type="checkbox" name="fields" value="Something" />
        </form>
        

        【讨论】:

          【解决方案5】:

          &lt;form action="processform.php" method="post"&gt;

          type 必须是method

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2015-11-05
            • 2018-06-05
            • 1970-01-01
            • 2022-01-05
            • 2011-06-26
            • 1970-01-01
            • 2013-06-12
            • 1970-01-01
            相关资源
            最近更新 更多