使用php变量对特定的href链接进行Jquery对话框确认

时间:2015-09-23 11:44:58

标签: javascript php jquery

当我按下从我的数据库中删除项目时,我想弹出一个jquery确认对话框,上面的代码在while($records=mysql_fetch_aray)内,所以我有几条记录:

echo"<tr>
    <td>".$registo["id_produto"]."</td>
    <td><img src='data:image/jpeg;base64,".base64_encode($registo["pic"])."' width='80' height='80'></td>
    <td>".$registo["nome"]."</td>
    <td>".$registo["preco"]."</td>
    <td>".$registo["quantidade"]."</td>
    <td>".$categoria."</td>
    <td>".$registo["descricao"]."</td>
    <td>".$registo["cura"]."</td>
    <td>".$registo["aroma"]."</td>
    <td><a href='deleteProduto.php?id={$registo["id_produto"]}'><i class='fa fa-times'></i> Delete</a></td>
    </tr>";

当我按下“删除”按钮时,我想弹出一个带有“是”和“否”的jquery确认对话框,当按下是时,转到“deleteProduto.php”,其中包含我想要的项目的相应ID删除。

我已经搜索了这个,但只是找到了这个使用表单,我只希望它使用带有相应“id”的'a href'链接。

1 个答案:

答案 0 :(得分:0)

我想知道你的代码是如何工作的,没有大量的警告和错误。

我认为您可能没有注意到它,因为您在其余代码中正确地执行了此操作

"...?id={$registo["id_produto"]}'>...";

定义没有合适的字符串组合。它必须是

"...?id=".$registo["id_produto"]."'>...";