??? ???? ?? ??
1. ??? ?? ??? ??? ?? ??
???? ??? ?? ??? js ??? ???????. /kindeditor-all.js" <</script> ? "?????????????????????????????????????????????????????????????????????????????????????????? ??:
<!DOCTYPE html> <html> <head> <title>留言板</title> <meta charset="UTF-8"> <script src="kindeditor/kindeditor/kindeditor-all.js"></script> </head> <body> <div><h1>留言板</h1></div> <div> <form action="insertdb.php" method="post"> 標題:<input type="text" id="title" name="title"><br> 內容:<br><span><textarea name="content" rows="13" cols="80" id="content"></textarea> <script> KindEditor.ready(function(K) { window.editor = K.create('#content',{ afterBlur:function(){this.sync();} }) }); </script> </span> <input type="submit" name="dosub" id="btn" value="上傳留言"> </form> </div> </body> </html>???? ??? ?? ?????.
2. ?? ??
??? ??? ????:
<?php
include './mysqli.php';
header('Content-type:text/html;charset=utf-8');
$tit=$_POST["title"];
$con=$_POST["content"];
$sql="insert into message(title,content) values('$tit','$con')";
if($mysqli->query($sql))
{
echo "留言成功,3秒后跳轉原頁面";
}else{
echo "留言失敗,3秒后跳轉原頁面";
}
header("Refresh:3;url=message.php");
3, ??? ?? ??? ????: