在ajax弹出窗口上提交按钮不起作用

时间:2013-09-12 07:12:52

标签: php mysql ajax button popup

我有一个这样的ajax弹出窗口......

<div class="white-popup-block" style="max-width:600px; margin: 20px auto;">
<?php
include "konekdb.php";
if(isset($_GET['kode_kb'])) {
    $kode_kb = mysql_real_escape_string($_GET['kode_kb']);

        $sql    = "SELECT * FROM  kb_tiny 
                         WHERE kode_kb='$kode_kb'" ;
        $query = mysql_query($sql, $koneksiDB) or die ("error query".mysql_error());
        $data = mysql_fetch_assoc($query);
        echo "Title : ".$data['title'];
        echo "No Ticket :".$data['no_ticket'];
        echo "Error Code : ".$data['error_code'];
        echo "example :  ".$data['ex_case'];
        echo "Solution :".$data['solution'];
        echo "Creator :  ".$data['creator'];
        echo "Date Modified :  ".$data['modified'];

}
?>
</br>
</br>
</br>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input name="approved" type="button" value="Approved" /> <input name="reject" type="button" value="Reject" />
</form>
</div>

当我点击我的select *数据库上的详细信息时,它显示如上所示的弹出窗口,当它弹出它提供批准和拒绝的按钮时... 如何处理该按钮,以便它可以更新我的数据库状态... 像这样的东西:

if(isset($_POST['approved'])) {
  $sql = "UPDATE `kb_tiny` SET `status` = 'approved'";

请帮助我如何使代码工作...... 数据已经显示但已批准按钮并拒绝不工作:(

3 个答案:

答案 0 :(得分:0)

type="button"更改为type="submit"

答案 1 :(得分:0)

替换此代码

<input name="approved" type="button" value="Approved" /> 
<input name="reject" type="button" value="Reject" />

<input name="approved" type="submit" value="Approved" /> 
<input name="reject" type="submit" value="Reject" />

答案 2 :(得分:0)

处理你的按钮只需更改其输入类型..

<input type="button" /> TO

<input type="submit" />