我想问当我单击下拉列表中的状态时如何显示案例描述。
状态来自数据库并加载到下拉列表中。
我已经从以前的版本更新了这个......但问题是它返回了这样的错误
警告:mysql_fetch_array():提供的参数不是 C:\wamp\www\StudentCases\StudentCasesInput.php 中的有效 MySQL 结果资源,第 112 行,它位于该区域
$sql ="SELECT * FROM casestatusfile WHERE CASESTATUSCODE = $casestatus";
$result=mysql_query($sql);
while($row=mysql_fetch_array($result)){
//$casestatuscode = $row['CASESTATUSCODE'];
$casedesc=$row['CASEDESC'];
这是我的代码:
<td>Case Code:</td>
<td>
include ('connect.php');
$sqlselect = "SELECT * FROM casestatusfile";
$resultselect = mysql_query($sqlselect);
echo "<select name = 'txtCaseStatus' id='txtCaseStatus' onChange='this.form.submit()'/>";
echo "<option value = ''>--- Select ---</option>";
while ($row = mysql_fetch_array($resultselect)) {
echo "<option value = '" . $row['CASESTATUSCODE'] ."'>" . $row['CASESTATUS'] ."</option>";
}
echo "</select>";
$casestatus = $_POST['txtCaseStatus'];
if (!empty($casestatus)){
//$db_name="ucsaosc";
$sql ="SELECT * FROM casestatusfile WHERE CASESTATUSCODE = $casestatus";
$result=mysql_query($sql);
while($row=mysql_fetch_array($result)){
//$casestatuscode = $row['CASESTATUSCODE'];
$casedesc=$row['CASEDESC'];
}
}
?>
从下拉列表中单击后,它将仅显示一条静态消息(案例已打开),但是当我单击下拉列表中的另一个值时,它不会更改...此外,下拉列表将重置回其第一个选项,即---选择--- ....请帮忙!?