如果我點擊刪除按鈕,然後向我請求刪除權限,但點擊確定後不刪除。從我的代碼ID刪除沒有得到。在我的瀏覽器搜索框顯示:帶警報的刪除按鈕在php中不起作用
本地主機/新/樹1/view_tree.php ID =
爲了得到ID代碼如下:?
<?php
include('connect.php');
$result = mysql_query("SELECT * FROM descriptionoftree WHERE vis=0 order by scientificname");
while($row = mysql_fetch_array($result))
{
echo '<tr>';
echo '<td >'.$row['scientificname'].'</td>';
echo '<td>'.$row['english_name'].'</div></td>';
echo '<td>'.$row['banglaname'].'</div></td>';
echo '<td>'.$row['groupname'].'</div></td>';
echo '<td><a href="update_tree.php? id='.$row['id'].'" title="Click To Update"><strong>Update</strong></a></td>';
?>
<td><a href="view_tree.php?id=<?php $row['id']?>
"onclick="return confirm('Are you sure you want to delete?')"<strong>Delete </strong></a></td>
<?php
echo '</tr>';
}
?>
對於刪除行代碼如下:
if(isset($_GET['id']))
{
$cid=$_GET['id'];
$sql=mysql_query("DELETE descriptionoftree WHERE id='$cid'");
}
如果你期望的PHP的JavaScript警告作出反應,你就錯了。 – durbnpoisn
在
@durbnpoisn中添加回聲沒有任何問題 –