回声的结果总是: "课程描述价值是:...谢谢" 使用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>
更新 我正在声明表格=&#34; implantForm&#34; 所以我删除了它,现在一切正常
答案 0 :(得分:1)
请在您的计划中添加<form>
标记,然后从form=implantForm
删除<textarea>
。此处我对您的代码进行了一些更改,然后我将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";
}
?>
答案 1 :(得分:0)
<强>形式= “implantForm”强> 这让浏览器感到困惑 textarea值甚至没有在请求中发送。删除它,现在一切正常
答案 2 :(得分:0)
请删除form =&#34; implantForm&#34;从textarea,然后它将工作。