我無法弄清楚爲什麼這不會得到textarea的值。我去過大量的stackoverflow帖子,我無法弄清楚什麼是錯的。我嘗試從textfields,從下拉列表等獲得值,他們都工作,我只是不能讓textarea工作。我已經使用_GET,仍然沒有工作。 這是我得到的消息,如果我不使用isset函數:注意:未定義的索引:descri。php無法從文本區域獲取文本
這裏的HTML:
<form role="form" action="saveform.php" method="post" name="eventform">
<div class="form-group">
<label for="descri">Description</label>
<textarea name="descri" form="eventform" style="resize:none"></textarea>
</div>
<button type="submit" class="btn btn-default" id="addform">add</button>
</form>
PHP:
<?php
if(isset($_POST['descri']))
{
echo htmlspecialchars($_POST['descri']);
} else {
echo "DOESNTWORK";
}
?>
爲什麼你需要form =「eventform」在textarea? – RJParikh
我在添加它的時候,我正在搜索什麼搞亂了,讀了在一些帖子中,我需要補充一點,當我做了一些事情雖然沒有奏效。所以我想我回到了我開始的地方。我認爲這是我的Jquery腳本來檢查textarea的長度,它以某種方式搞亂了它。 –