PHP的组合框和放大器;按钮应该隐藏一次更新到MySQL数据库并显示成功消息,而不是组合框和放大器;按钮的地方。 [英] php combobox & button should hide once updated into mysql db and show success message instead of combobox & button place.

查看:104
本文介绍了PHP的组合框和放大器;按钮应该隐藏一次更新到MySQL数据库并显示成功消息,而不是组合框和放大器;按钮的地方。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过用户输入表单(组合框型)在这里,我更新的一个字段值。更新过程可以正常使用。但是,存储的数据后,分贝它应该显示我在组合框中选择我的价值,然后将该COMBOX箱和功放;更新按钮必须隐藏更新一次,它应该显示消息成功更新,而不是组合框和放大器;按钮。不使用JavaScript的alert方法。这不是一个警报消息。在DB的组合框更新一次数据应该隐藏,然后成功的消息应该在特定的显示。

这是我的主网页编码:

 而($ a_row = mysql_fetch_array($ SQL))
    {
            回声\\ T< TD>中。 $ a_row ['guest虚拟机名称。 &所述; / TD>中;
            回声\\ T< TD>中。 $ a_row ['AGENTNAME']。 < / TD> \\ N的;
        回声\\ T< TD><形式的行动= statusdb.php方法=后>
        <选择名称=更新><期权价值=空>< /选项><期权价值=确认>确认< /选项><期权价值=处理>处理< /选项><期权价值=待定>待< /选项><期权价值=取消>取消< /选项>< /选择>
        <输入名称= ID =类型隐藏的价值='。$ a_row ['slno']'。;>
        <输入类型=提交值=更新>
       < /表及GT;
        < / TD> \\ N的;
        回声< / TR> \\ N的;
    }

这是我的statusdb编码:

 如果(使用isset($ _ POST ['身份证']))
{
$ ID = mysql_real_escape_string($ _ POST ['身份证']);
$更新= mysql_real_escape_string($ _ POST ['更新']);
$ SQL =的mysql_query(更新guest_details设置状态='$更新'WHERE slno ='$ ID');
如果(!$ SQL)
{
    死亡(错误.mysql_error());
}
其他
{
    回声< HTML和GT;<身体的onload = \\警报(状态更新成功'); \\>< /身体GT;< / HTML>中;
}
}


解决方案

我想这会工作。

尝试添加一行呼应AGENTNAME后以下内容:

 如果($ a_row ['状态']!='空'){
    回声\\ T< TD>中。 $ a_row [$状态。 < / TD> \\ N的;
}其他{
    //这里就是你会把接下来的6行
}

PS:我没有看到一个开口< TR> 标签

here i updated one field value through user input form (combo box type). update process is working perfectly. but, after data stored in db it should show the value what i'm selected in combo box and then that combox box & update button must hide once updated and it should show message "updated successfully" instead of combo box & button. NOT USING JAVASCRIPT ALERT METHOD. THIS IS NOT A ALERT MESSAGE. once updated data in db that combo box should hide and then success message should show in that particular .

this is my main page coding :

while($a_row = mysql_fetch_array($sql))
    { 
            echo "\t<td>" . $a_row['guestname'] . "</td>";
            echo "\t<td>" . $a_row['agentname'] . "</td>\n";
        echo "\t<td><form action=statusdb.php method=post>
        <select name=update><option value=empty></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 value=Update>
       </form>
        </td>\n";
        echo "</tr>\n";
    }

this is my statusdb coding :

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)
{
    die("Error" .mysql_error());
}
else
{
    echo "<html><body onload=\"alert('Status Updated Successfully');\"></body></html>";
}
}

解决方案

I'm thinking this would work.

Try adding the following after the line echoing the agentname:

if ( $a_row['status'] != 'empty' ) {
    echo "\t<td>" . $a_row[$status] . "</td>\n";
} else {
    // here's where you'd put the next 6 lines
}

PS: I don't see an opening <tr> tag.

这篇关于PHP的组合框和放大器;按钮应该隐藏一次更新到MySQL数据库并显示成功消息,而不是组合框和放大器;按钮的地方。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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