我试图在用户删除数据之前将弹出消息放入此代码中.这是我的代码.
while ($test = mysql_fetch_array($result))
{
$id = $test['FailID'];
echo "<tr align='center'>";
echo"<td><font color='black'>" .$test['FailID']."</font></td>";
echo"<td><font color='black'>" .$test['TajukFail']."</font></td>";
echo"<td><font color='black'>". $test['JilidFail']. "</font></td>";
echo"<td><font color='black'>". $test['StatusFail']. "</font></td>";
echo"<td> <a href ='daftarkemaskini.php?FailID=$id'>Edit</a>";
echo"<td> <a href ='padamfail.php?FailID=$id'><center>Delete</center></a>";
echo "</tr>";
}
Run Code Online (Sandbox Code Playgroud)
但是当我把它放在那里它根本不起作用.
echo"<td> <a href ='padamfail.php?FailID=$id' onClick="return confirm('are you sure you want to delete??');"><center>Delete</center></";>"
Run Code Online (Sandbox Code Playgroud)
谁可以帮我这个事?
你需要逃避双引号.您的代码最后还有另一个语法错误.
echo "<td> <a href='padamfail.php?FailID=$id' onClick=\"return
confirm('are you sure you want to delete??');\"><center>Delete</center></a>";
Run Code Online (Sandbox Code Playgroud)