2012-07-15 33 views
3

以下頁面不按提交按鈕後發送沒有在POST請求:爲什麼「<input>」元素不發佈數據?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 
<html> 
<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
    <title>My title</title> 
</head> 
<body> 


       <form id="myform" method="POST" action="save.php" > 

        <label for="title">Title: </label> 
        <input id="title" type="text" size="80" value="Damned"/> 

        <input type="submit"> 

       </form> 


</body> 
</html> 

爲什麼?

+0

這不是有效的HTML(比在下面的答案其它原因)。使用[HTML驗證程序](http://validator.w3.org/)進行檢查。 – 2012-07-15 21:44:27

+0

請使用有意義的非優質標題。 – 2012-07-15 23:11:06

回答

14

他們不服從。您必須更改

<input id="title"> 

<input id="title" name="somethingThatWillAppearIn$_POST"> 
+0

哦,我可憐的頭:D – 2012-07-15 21:44:17

+2

沒有那麼多的變化,但你需要一個名稱屬性,它與表格一起發送。 – Martin 2012-07-15 21:44:52

+0

@Martin Aye,我在你的評論前幾​​秒鐘就編輯過了。 – 2012-07-15 21:45:51