【php开源代码栏目提醒】:文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。网学会员整理了php开源代码-deleteBook.php的相关内容供大家参考,祝大家在新的一年里工作和学习顺利!
<html>
<head>
<link href="style.css" rel="stylesheet">
<script type=text/javascript>
var xmlHttp;
function createXMLHttpRequest(){
if(window.ActiveXObject){
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest){
xmlHttp=new XMLHttpRequest();
}
}
function Start(ele){
id=ele.id;
createXMLHttpRequest();
var url="GetDeleteBook.php?key="+escape(ele.id);
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=Del;
xmlHttp.send(null);
}
function Del(){
if(xmlHttp.readyState==4){
if(xmlHttp.status==200){
if(xmlHttp.responseText=="1")
{
alert("该项已被删除");
window.location.reload();
}
else{
alert("页面可能出现错误,请重新试一下");
}
}
}
}
</script>
</head>
<body style="margin-top:0; font-size:12px">
<center>
<table width="90%" cellpadding="0" cellspacing="0">
<tr>
<td background="../image/headerbg.jpg">
<img src="../image/Header.jpg">
</td>
</tr>
</table>
<table width=90% align=center style="background-color: #FFFFFF;
border-top-width: 0px;
border-right-width: 1px;
border-bottom-width: 0px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: #0064A6;
border-right-color: #0064A6;
border-bottom-color: #0064A6;
border-left-color: #0064A6;">
<caption>图书信息删除</caption>
<th>名称</th><th>作者</th><th>出版社</th><th>ISBN号</th><th>图书类型</th><th>价格</th><th>删除 </th>
<?php
$link=mysql_connect("localhost","root","0");
my
sql_select_db("books");
$exec="select * from mybook";
$result=
mysql_query($exec);
while($rs=mysql_fetch_object($result))
{
$id=$rs->id;
$name=$rs->name;
$author=$rs->author;
$pub=$rs->publisher;
$isbn=$rs->isbn;
$type=$rs->type;
$price=$rs->price;
$content="<tr><td>".$name."</td><td>".$author."</td><td>".$pub."</td><td>".$isbn."</td><td>".$type."</td><td>".$price."</td><td><p id='".$id."' onclick='Start(this)' style='color:blue;cursor:hand'>删除</p></td></tr>";
echo $content;
}
?>
</table>
<p align="center">|<a href="chakan.php">操作主页</a>|<a href="addBook.php">数据添加</a>|<a href="update.php">数据修改</a>|</p>
<br>
</center>
<table width="90%" style="font-size:12px;border-top-style:solid;border-bottom-style:none;border-right-style:none;border-left-style:none;" cellspacing="0" cellpadding="4" align="center">
<tr>
<td> <div align="center">
IT在中国电脑学习网!@2007</br>
公司地址:郑州市二七路200号金博大D座2708室</br>
电话:66202195
电子邮件:<A HREF='mailto:liuhaisong9462@sohu.com'></A> itzcn@126.com
</div></td>
</tr>
</table>
</body>
</html>