0

我有这个链接:

echo"<a href=\"$urlHTML\" onclick="return confirm('Please Confirm You Wish to Add these Details')">Delete</a>";

它用于将剥离的字符链接传递到页面,但在此之前使用 javascript 函数来让用户确认他们想要继续。基本上,在上面的链接上,我收到以下错误:

Parse error: syntax error, unexpected T_RETURN, expecting ',' or ';' in E:\xampp\htdocs\IDB\delete.php on line 411.

如果有人能告诉我哪里出错了,那就太好了!

4

5 回答 5

1

这个应该工作:

echo '<a href="'.$urlHTML.'" onclick="return confirm(\'please confirm\')">Delete</a>';
于 2012-04-24T09:06:38.670 回答
0

尝试:


echo "<a href=\"$urlHTML\" onclick=\"return confirm('Please Confirm You Wish to Add these Details')\">Delete</a>";
于 2012-04-24T09:01:08.883 回答
0

逃离“符号

echo"<a href=\"$urlHTML\" onclick=\"return confirm('Please Confirm You Wish to Add these Details')\">Delete</a>";
于 2012-04-24T09:01:20.357 回答
0

让它像这样

 echo"<a href=\"$urlHTML\" onclick=\"return confirm('Please Confirm You Wish to Add these Details')\">Delete</a>";

您忘记转义 onclick 的内部双引号。

于 2012-04-24T09:01:39.350 回答
0

分离 PHP 和 HTML

?>
<a href="<?=$urlHTML?>" onclick="return confirm('Please Confirm You Wish to Add these Details')">Delete</a>
<?php
于 2012-04-24T09:03:09.543 回答