PHP 개발 게시판 답변 페이지

답글 기능 마지막 소개:

<?php

session_start();

header("content-type:text/html;charset=utf-8");
//连接数据库
$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"回复成功"."<br/><br/>";
   echo"<a href='list.php'>跳转至留言列表页面</a>";
}else{
   echo"回复失败"."<br/><br/>";
   echo"<a href='reply.html'>跳转至回复编辑页面</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>回复页面</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']?>">
回复:<textarea style="width: 380px;height: 200px;" name="reply"></textarea><br/><br/>
       <input type="submit" value="确认回复">
   </form>
</div>
</div>
</body>
</html>


지속적인 학습
||
<?php session_start(); header("content-type:text/html;charset=utf-8"); //连接数据库 $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"回复成功"."<br/><br/>"; echo"<a href='list.php'>跳转至留言列表页面</a>"; }else{ echo"回复失败"."<br/><br/>"; echo"<a href='reply.html'>跳转至回复编辑页面</a>"; } ?> <!DOCTYPE html> <html lang="en"> <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>回复页面</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']?>"> 回复:<textarea style="width: 380px;height: 200px;" name="reply"></textarea><br/><br/> <input type="submit" value="确认回复"> </form> </div> </div> </body> </html>
  • 코스 추천
  • 코스웨어 다운로드
현재 코스웨어를 다운로드할 수 없습니다. 현재 직원들이 정리하고 있습니다. 앞으로도 본 강좌에 많은 관심 부탁드립니다~