无法通过post方法获取textarea的值 [英] Cannot get the value of a textarea via post method

查看:181
本文介绍了无法通过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).

这篇关于无法通过post方法获取textarea的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆