0

次の HTML5 フォームがあります。

  <form action="/desired_worktimes/submit" method="post">
    <div class="month">
      <h2>October</h2>
      <div class="week">
        <h3>2013-10-21–2013-10-21</h3>    
        <p>
          <span>Mon</span>

          <label for="from-2013-10-21">From</label>
          <input type="time" id="from-2013-10-21" />

          <label for="to-2013-10-21">To</label>
          <input type="time" id="to-2013-10-21" />

          <label for="free-2013-10-21">Free</label>
          <input type="checkbox" id="free-2013-10-21" />

        </p>
      </div>
    </div>

  <button type="submit">Submit</button>
  </form>

送信を押しても、投稿エンドポイントにデータが届きません。Postmanでサーバーをテストしました。エンドポイントに送信されたすべてのフォーム データが表示されますが、上記のフォームでは何も表示されません。

フォームの何が問題になっていますか?

4

2 に答える 2

4

name入力ごとに属性を使用する必要があります。例: <input type="time" id="from-2013-10-21" name="abc"/>. これらの入力の値を取得するには、単に を使用します$_POST['abc']

于 2013-10-21T10:31:29.063 に答える
2

Check the last line of your code and also you have not included name attribute in any of your form fields:

Instead of this:

<button type="submit">Submit</button>

It should have been this:

<input type="submit" value="submit">
于 2013-10-21T10:29:40.283 に答える