我有一些PHP代码,我正在尝试添加删除确认。但是导致错误......
$arr_data[$array_pos][] = 'a href="delete.php?pid='.$row['pid'].'"
onclick="return confirm('Are you sure want to delete')">delete<';
onclick
代码导致问题。凭借我非常有限(零!)的知识,我无法找到解决办法,所以任何帮助都会受到赞赏。
onclick="return confirm('Are you sure want to delete')"
(我删除了超链接HTML代码以便显示)
答案 0 :(得分:2)
你需要逃避单引号。
$arr_data[$array_pos][] = '<a href="delete.php?pid=' . $row['pid'] . '" onclick="return confirm(\'Are you sure you want to delete?\')">Delete</a>';