无法通过post方法获取textarea的值

问题描述:

这是一个非常简单的表格,如下面的代码所示:

It is a very simple form as in the code below:

 <form method="POST" action="news.php?nid=2">
  <textarea id="txtcomment" style="width:100%; height: 70px;" maxlength="300"></textarea><br /><br />
  <input type="submit" class="button" style="float: right; cursor:pointer;" value="Comment">
 </form>

但在news.php中我无法获得txtcomment的价值

but in the news.php i cannot get the value of "txtcomment"

 echo $_POST['txtcomment'];

它什么也不返回......

it returns nothing...

这是因为你需要命名textarea:

It is because you need to name the textarea:

<textarea name="txtcomment"></textarea>

id 参数没有任何内容如何使用表单(除了标签 s,但这在这里并不重要)。

The id parameter does not have anything to do with how forms work (with the exception of labels, but that is not important here).