PHP開發(fā)留言板之回復(fù)頁面
最后一個介紹回復(fù)功能:
<?php session_start(); header("content-type:text/html;charset=utf-8"); //連接數(shù)據(jù)庫 $link = mysqli_connect("localhost","root","root","message"); mysqli_set_charset($link,"utf8"); if (!$link) { die("連接失敗: " . mysqli_connect_error()); } $id = isset($_GET['id'])?$_GET['id']:""; $reply = isset($_POST['reply'])?$_POST['reply']:""; $sql ="update details set reply='$reply' where id=".$id; $rel = mysqli_query($link,$sql); if($rel){ echo"回復(fù)成功"."<br/><br/>"; echo"<a href='list.php'>跳轉(zhuǎn)至留言列表頁面</a>"; }else{ echo"回復(fù)失敗"."<br/><br/>"; echo"<a href='reply.html'>跳轉(zhuǎn)至回復(fù)編輯頁面</a>"; } ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> <meta name="format-detection" content="telephone=no" /> <title>回復(fù)頁面</title> <style> .w410{ width: 410px; } .fon_f{ font-family: 微軟雅黑; } .pt{ padding-top: 80px; } </style> </head> <body> <div style="margin: 0 auto;" class="fon_f w410"> <div> <h1 style= "text-align:center;">留言窗口</h1> </div> <div style="margin: 0 auto;" class="pt lh"> <form name="form1" method="post" action="reply.php?id=<?php echo $_GET['id']?>"> 回復(fù):<textarea style="width: 380px;height: 200px;" name="reply"></textarea><br/><br/> <input type="submit" value="確認(rèn)回復(fù)"> </form> </div> </div> </body> </html>