在我的索引页面中,我使用组合框将用户状态更新为 mysql db,然后显示用户在组合框中选择的值。这些都完美地工作(更新到mysql,显示他们选择的价值)。我想使用加载(gif)图像。例如,如果用户选择一个选项并且当他们单击更新按钮时,我需要显示加载页面符号(2 到 3 秒),然后在该位置显示他们选择的值。如何显示加载器图像选项?
主页代码:
while($a_row = mysql_fetch_array($sql))
{
if ( $a_row['status'] != '' ) {
if ( $a_row['status'] == 'Confirm' ) {
echo "\t<td><font color=\"green\"><b>" . $a_row['status'] . "</b></font></td>\n";
}
else if ( $a_row['status'] == 'Processing' ) {
echo "\t<td><font color=\"blue\"><b>" . $a_row['status'] . "</b></font></td>\n";
}
else if ( $a_row['status'] == 'Pending' ) {
echo "\t<td><font color=\"orange\"><b>" . $a_row['status'] . "</b></font></td>\n";
}
else if( $a_row['status'] == 'Cancelled' ) {
echo "\t<td><font color=\"red\"><b>" . $a_row['status'] . "</b></font></td>\n";
}
}
else {
echo "\t<td width=166><form method=post>
<select name=update><option></option><option value=Confirm>Confirm</option><option value=Processing>Processing</option><option value=Pending>Pending</option><option value=Cancelled>Cancelled</option></select>
<input name=id type=hidden value='".$a_row['slno']."';>
<input type=submit name=submit value=Update>
</form>";
更新状态码:
if($_SERVER['REQUEST_METHOD'] == "POST")
{
if(isset($_POST['id']))
{
$id = mysql_real_escape_string($_POST['id']);
$update= mysql_real_escape_string($_POST['update']);
$sql = mysql_query("UPDATE guest_details SET status = '$update' WHERE slno = '$id'");
if(!$sql)
{
echo ("Could not update to database" .mysql_error());
}
}
}