我已经对此主题进行了一些研究,发现在 php 中使用确认框的方法之一是使用 javascript onclick()
。我有这个不起作用的代码。
echo '<td class="item_unsold"><a href = "manage-products.php?prod='.$row[0].'" style="color:red" onclick="return confirm("Are you sure you want to delete this product ?")">Delete</a></td>';
我认为问题在于使用'
and"
但我不确定如何构造这个回声。当我在其中使用单引号时confirm('Are you sure you want to delete this product')
,也会出现错误。有什么想法可以构造这个回声吗?谢谢