<meta HTTP-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
$lianjie = mysql_ connect("localhost","root","xiaolie") or die("連接失敗");
mysql_query("set names utf8");
if(@$_POST["ok"])
{
mysql_select_db("xiaolie");
//插入資料
$shuju = " insert into hao (name, neirong,shijian) values ('".$_POST["name"]."','".$_POST["neirong"]."','".date("Y-m-d H:m:s")."')";
$fasong = mysql_query($shuju) or die(mysql_error());
if($fasong)
{
header("location:/a2/ly.php");
}
else
{
echo "內容發表失敗<br><a href=fb_my.php>返回</a>";
}
}
else
{
/* mysql_select_db("xiaolie");
//發送查詢
$fasong = mysql_query("select * from hao") or die(mysql_error());
while($nr = mysql_ fetch_array($fasong))
{
echo "<table border=1>
<tr >
<td width='60'>第 ".$nr["id"]." 樓</td>
<td width='140'>發表使用者:".$nr["name"]." </td>
<td width='230'>發表時間:".$nr["shijian"]." </td>
</tr>
<tr><td colspan='3' width ='430'>".$nr["neirong"]." </td></tr>
</table>";
}
*/
?>
<form method=post action=fb_my.php>
姓名<input type=text name="name" /><br>
發表<br><textarea name="neirong" cols="50" rows="5"></textarea><br>
<input type=submit name="ok" value="好的" />
</form>
<?php
}
?>