标签:
/*deal_edit.php*/ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>编辑处理</title> </head> <body> <?php include_once"connect.php"; $id=$_POST[‘id‘]; //接受从编辑界面传过来的值。 $name=$_POST[‘name‘]; $sex=$_POST[‘sex‘]; $age=$_POST[‘age‘]; if($_GET[‘ud‘]) { $ud=$_GET[‘ud‘]; $sql="select * from stu where stu_id=$ud";//从数据库中选择将要编辑的学生信息。 $re=mysql_query($sql) or die(mysql_error()); if(!mysql_num_rows($re)) { echo "ID wrong"; } $row=mysql_fetch_array($re); if(!empty($name)||trim($name)!=‘‘) //判断姓名是否为空 { $sql="update stu set stu_name=‘".$name."‘,stu_id=‘".$id."‘,stu_age=‘".$age."‘,stu_sex=‘".$sex."‘ where stu_id=$id"; mysql_query($sql) or die(mysql_error()); // echo "<center>"; // echo "Edit success!"; // echo ‘<a href="sy.php"><input name="return" type="button" value="return" ></a>‘; // echo "</center>"; header(‘location:table.php‘); mysql_close($conn); } } else { echo "fail to delete!"; mysql_error(); } ?> </body> </html>
标签:
原文地址:http://www.cnblogs.com/-beyond/p/5621243.html