不能在请求中获取TextArea值,总是空的
Can't get TextArea value in the Request, always empty
echo的结果总是:"课程描述值为……谢谢"使用Course_Desc
的空值 <?
if (isset($_REQUEST["saveEdites"])) {
$id = $_REQUEST['ProtocolID'];
$Course_Desc = $_REQUEST['Course_Descr'];
$Course_Desc = trim($Course_Desc);
$Course_Desc = stripslashes($Course_Desc);
$Course_Desc = htmlspecialchars($Course_Desc);
echo "Course Description Value is : ".$Course_Desc." ...Thanks";
}
?>
<form method="post" name="implantForm">
<table >
<input type="hidden" name="ProtocolID" id="Protocol">
<tr align="Left">
<td>
<label style="color:#ff6600;font-weight:bold">
Name
</label>
</td>
<td>
<label id="formLbl"></label>
</td>
</tr>
<tr align="Left" style="color:#ff6600;font-weight:bold">
<td>Protocol </td>
<td>
<textarea id="formTXT" rows="4" cols="50" name="Course_Descr" form="implantForm"></textarea>
</td>
</tr>
</table>
<table>
<tr align="center" >
<td>
<input type="submit" name="saveEdites" value="Save changes">
</td>
</tr>
</table>
</form>
我声明form="implantForm"所以我把它删除了,现在一切都正常了
请将<form>
标签放在您的程序中,并从<textarea>
中删除form=implantForm
。在这里我对代码进行了一些更改,然后我得到textarea值作为输出
<form>
<table >
<input type="hidden" name="ProtocolID" id="Protocol">
<tr align="Left">
<td>
<label style="color:#ff6600;font-weight:bold">
Name
</label>
</td>
<td>
<label id="formLbl"></label>
</td>
</tr>
<tr align="Left" style="color:#ff6600;font-weight:bold">
<td>Protocol </td>
<td>
<textarea id="formTXT" rows="4" cols="50" name="Course_Descr" ></textarea>
</td>
</tr>
</table>
<table>
<tr align="center" >
<td>
<input type="submit" name="saveEdites" value="Save changes">
</td>
</tr>
</table>
</form>
<?php
if (isset($_REQUEST["saveEdites"])) {
$id = $_REQUEST['ProtocolID'];
$Course_Desc = $_REQUEST['Course_Descr'];
$Course_Desc = trim($Course_Desc);
$Course_Desc = stripslashes($Course_Desc);
$Course_Desc = htmlspecialchars($Course_Desc);
echo "Course Description Value is : ".$Course_Desc." ...Thanks";
}
?>
形式="implantForm"这就是让浏览器困惑的地方文本区域值甚至没有在请求中发送。删除它,现在一切都正常了
请从textarea中删除form="implantForm",这样就可以了
相关文章:
- ajax请求的顺序总是不同的
- Meteor如何接收HTTP请求
- 有没有一种方法可以防止img get请求使用css或js发生
- 从ajax请求中获取javascript对象
- JSONP请求返回结果,但也触发error_callback
- 在localhost Dev Box上测试JSONP请求的最佳方式
- Ajax请求文档就绪会导致jquery加载缓慢
- 当值更改时,在servlet中自动获取textarea值,无需单击按钮
- 验证Javascript中的Textarea
- MockJax没有在JavaScript应用程序中发送对我AJAX请求的响应
- 正在传递JSONP标头's数据参数到另一个文件中的AJAX请求
- 在openshift node js应用程序中获取请求
- Textarea必需的attribut在javascript中不起作用
- 反应路由器弄乱了请求网址
- 在我的情况下,如何进行http请求
- 使用密码对话框Javascript请求帮助
- servlet中的请求对象,而不是从jsp接收参数值
- 否'访问控制允许来源'标头存在于IISNOde中请求的资源(AngularJS+NodeJs)上
- JavaScript代码未正确检查ajax请求
- 不能在请求中获取TextArea值,总是空的