表单 index.php
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>留言板</title>
</head>
<body>
<span>留言板</span>
<div>
<form action="liuyan.php" method="post">
<table>
<tr>
<td><input type="text" name="user" placeholder="网名"/></td>
</tr>
<tr>
<td><textarea name="contern" cols="50" rows="5" placeholder="留言内容"></textarea></td>
</tr>
<input type="submit" value="发表留言"/>
</form>
</div>
<div>
<?php
$cc=mysqli_connect("localhost","root",""); //连接MySQL数据库
$db=mysqli_select_db($cc,"test"); //选择数据库
$sql="select * from liuyan"; //查看liuyan表所有的数据
$re=mysqli_query($cc,$sql); //执行SQL语句
echo "<table width='800'>";
echo "<tr><th>留言用户</th><th>留言内容</th><th>留言时间</th></tr>";
while($r=mysqli_fetch_array($re,M