PHP Development Enterprise ???? ???? ?? ??? ??
?? ?? ??? ??? ?????
id? ?? ??????? ??? ??? ? ?? ??? ?? ??? ? ?? ??? ???? ??? ???? ?? ??? ??? ?????
??? ??????? ??:
<?php require_once('conn.php'); $id = $_GET['id']; $sql = "SELECT * from contact where id='$id'"; $res = mysql_query($sql); $row = mysql_fetch_array($res); ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>修改公司信息</title> <style type="text/css"> .ipt{width:180px;height:30px;border-radius:5px; outline:none;border:1px solid #eee;box-sizing:border-box;padding-left:15px;} .txt{width:250px;height:200px;} .sub{width:50px;height:20px;border:1px solid #eee;background:#eee;color:#ff7575;} </style> </head> <body> <form method="post" action="modifyontact.php?id=<?php echo $id;?>"> 公司地址:<input type="text" name="site" class="ipt" value="<?php echo $row['site'];?>"> </br></br> 公司電話:<input type="text" name="tel" class="ipt" value="<?php echo $row['tel'];?>"> </br></br> 技術(shù)支持:<input type="text" name="suppot" class="ipt" value="<?php echo $row['suppot'];?>"> </br></br> 售后電話:<input type="text" name="nexttel" class="ipt" value="<?php echo $row['nexttel'];?>"> </br></br> 公司傳真:<input type="text" name="fax" class="ipt" value="<?php echo $row['fax'];?>"> </br></br> 公司主頁:<input type="text" name="home" class="ipt" value="<?php echo $row['home'];?>"> </br></br> 電子郵件:<input type="text" name="email" class="ipt" value="<?php echo $row['email'];?>"> </br></br> <input type="submit" value="修改" class="sub"> </form> </body> </html>
?? ??? ?? ?? ??? ???? ?? ID? ?? ??????? ??? ???? ?????. modontact.php ???? ??? ???? ??? ???????.
<?php require_once('conn.php'); $id = $_GET['id']; $site = $_POST['site']; //地址 $tel = $_POST['tel']; //電話 $suppot = $_POST['suppot'];//技術(shù)支持 $nexttel = $_POST['nexttel'];//售后電話 $fax = $_POST['fax']; //公司傳真 $home = $_POST['home']; //公司首頁 $email = $_POST['email']; //電子郵件 $sql = "UPDATE contact set site='$site',tel='$tel',suppot='$suppot',nexttel='$nexttel',fax='$fax',home='$home',email='$email' where id='$id'"; // echo $sql;die; $res = mysql_query($sql); if($res){ echo "<script>alert('修改公司信息成功');location.href='contact.php'</script>"; }else{ echo "<script>alert('修改公司信息失敗');history.go(-1);</script>"; } ?>
?? ??? ?? ?? ???? ?? ???? sql ?? ???? ???? ??? ?????. ???? ??? ???? ?? ???? ?????. ??? ???? ?? ???? ?????