主页面
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
</head>
<body>
<form action="getValue.php" method="post">
标题: <input type="text" name="title" id="title"/> <br/>
<?php
include("fckeditor/fckeditor.php") ;
$oBasePath = $_SERVER['PHP_SELF'];
$oBasePath = dirname($oBasePath)."/fckeditor/";
$oFCKeditor = new FCKeditor('FCKeditor1') ;
$oFCKeditor->BasePath= $oBasePath ;
$oFCKeditor->Height = "500px";
// $oFCKeditor->ToolbarSet = "Basic";
$oFCKeditor->Create() ;
?>
<input type="submit" value="提交" name="submit"/>
</form>
</body>
</html>
执行
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<?php
if(isset($_POST["submit"])){
$title = $_POST['title'];
$FCKeditor1= addslashes($_POST["FCKeditor1"]);
$conn = @mysql_connect("localhost","root","") or die("数据库连接失败,请检查你的网络,稍后再试试");
mysql_select_db("test");
mysql_query("set names 'utf8'");
$sql = "INSERT INTO `test`.`gx` (`id`,`title`,`neirong`) VALUES (NULL, '$title', '$FCKeditor1')";
mysql_query($sql);
// $id = mysql_insert_id();
$sql = "SELECT * FROM `gx`";
$result = mysql_query($sql);
}
while($row = mysql_fetch_array($result)){
?>
标题:<?php echo $row['title']?><br/>
内容:<?php echo $row['neirong']?><br/>
<?php
}
?>
<!--addslashes 单引号 转换-->