首页 > 解决方案 > 将 MYSQL 生成的选定记录移动到另一个表 - 复选框和按钮

问题描述

HTML表格:

<table width="100%"  cellpadding="0" cellspacing="0" border="0" id="table" class="tablesorter">
<thead>
    <tr>
        <th><h3>ID</h3></th>
    </tr>
</thead>
    <tfoot>
    <tr>
        <th><h3>ID</h3></th>
    </tr>
    </tfoot>
        <tbody>
            <?php getClicksReport(); ?>
        </tbody>

函数PHP:

function getClicksReport() {
$query = mysql_query("SELECT * FROM clicks ORDER BY id DESC") or die(mysql_error());
while($click = mysql_fetch_assoc($query)) {
    echo '<tr>';
    echo '<td>' . $click['id'] . '<span class="idcheckbox"><input name="id[]" type="checkbox" value="'.$click['id'].'"/></td>';
}

}

和.....

if(isset($_POST['akceptlead']) && $_POST['id']){
$total = count($_POST['id']);
    for($i=0; $i<$total; $i++) {
        $akceptujLeada = mysql_query("DELETE FROM leads WHERE id ='".$_POST['id'][$i]."'") or die(mysql_error());
    }
    header("Location: clicksReport.php");

}

我在表格 html 中选择记录,单击“接受选择”按钮,但没有任何反应。

任何人都可以帮助我吗?

标签: phphtmlmysql

解决方案


推荐阅读