【问题标题】:How to fix error in delete confirmation message in php如何修复php中删除确认消息中的错误
【发布时间】:2013-01-30 18:41:10
【问题描述】:

我有一些 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 代码以便显示)

【问题讨论】:

    标签: php confirmation


    【解决方案1】:

    你需要转义单引号。

    $arr_data[$array_pos][] = '<a href="delete.php?pid=' . $row['pid'] . '" onclick="return confirm(\'Are you sure you want to delete?\')">Delete</a>';
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-06-07
      • 1970-01-01
      • 2013-05-18
      • 2012-11-03
      • 1970-01-01
      • 2011-05-26
      • 2021-04-19
      相关资源
      最近更新 更多