亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

PHP development message board message page

This section talks about the second page, the message page, which is the step of writing data and inserting data into the database through the message page.

<?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());
}
$name = isset($_POST['name'])?$_POST['name']:"";
$title = isset($_POST['title'])?$_POST['title']:"";
$content = isset($_POST['content'])?$_POST['content']:"";
$time = date("Y-m-d H:i:s");

$sql ="insert into details(name,title,content,time) values('$name','$title','$content','$time')";
$rel = mysqli_query($link,$sql);

if($rel){
   echo"留言成功"."<br/><br/>";
   echo"<a href='list.php'>跳轉至留言列表頁面</a>";
}else{
   echo"留言失敗"."<br/><br/>";
   echo"<a href='form.html'>跳轉至留言編輯頁面</a>";
}
?>
<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
}
       .mr_auto{
           margin:0 auto;
}
       .w400{
           width:400px
}
   </style>
</head>
<body>
<div  class="w410 mr_auto">
<!--頭部圖片-->
<div>
       <img src="https://img.php.cn/upload/course/000/000/007/5816db62346b9319.jpg">
   </div>
   <div style="padding-top: 30px;" class="mr_auto w400">
       <form method="post" name="form1" id="form1" action="message.php">
標題:<input type="text" name="title"><br/><br/>
內(nèi)容:<textarea style="width:350px;height:200px;" name="content"></textarea><br/><br/>
作者:<input type="text" name="name"><br/><br/>
           <a href=""><input type="submit" style="margin-left:350px" value="提交"></a>
       </form>
   </div>
   </div>
</body>
</html>


Continuing Learning
||
<?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()); } $name = isset($_POST['name'])?$_POST['name']:""; $title = isset($_POST['title'])?$_POST['title']:""; $content = isset($_POST['content'])?$_POST['content']:""; $time = date("Y-m-d H:i:s"); $sql ="insert into details(name,title,content,time) values('$name','$title','$content','$time')"; $rel = mysqli_query($link,$sql); if($rel){ echo"留言成功"."<br/><br/>"; echo"<a href='list.php'>跳轉至留言列表頁面</a>"; }else{ echo"留言失敗"."<br/><br/>"; echo"<a href='form.html'>跳轉至留言編輯頁面</a>"; } ?> <html lang="zh-CN"> <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 } .mr_auto{ margin:0 auto; } .w400{ width:400px } </style> </head> <body> <div class="w410 mr_auto"> <!--頭部圖片--> <div class="head"> <img class="w1200" src="http://img.php.cn/upload/course/000/000/007/5816db62346b9319.jpg"> </div> <div style="padding-top: 30px;" class="mr_auto w400"> <form method="post" name="form1" id="form1" action="message.php"> 標題:<input type="text" name="title"><br/><br/> 內(nèi)容:<textarea style="width:350px;height:200px;" name="content"></textarea><br/><br/> 作者:<input type="text" name="name"><br/><br/> <a href=""><input type="submit" style="margin-left:350px" value="提交"></a> </form> </div> </div> </body> </html>
submitReset Code