表单中加载了百度编辑器,如何用PHP获取编辑器里的内容并传入数据库?
<formmethod="post"action="add.php"><tablecellpadding="0"cellspacing="2"border="1"widt...
<form method="post" action="add.php">
<table cellpadding="0" cellspacing="2" border="1" width="850" height="600" align="center">
<tr>
<td align="center" width="100"><h4>发表人:</h4></td>
<td width="750"><input type="text" name="username" value="" /></td>
</tr>
<tr>
<td align="center" width="100"><h4>标题:</h4></td>
<td width="750"><input type="text" name="text" value="" /></td>
</tr>
<tr>
<td align="center" width="100"><h4>内容:</h4></td>
<td width="750"><script id="container" name="content" type="text/plain"></script>
</td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="tianjia" value="添加"/> <input type="reset" value="重置"/></td>
</tr>
</table>
<script type="text/javascript">
var ue = UE.getEditor('container');
</script>
</form>
<?php
if(!empty($_POST['tianjia'])){
$username=$_POST['username'];
$text=$_POST['text'];
$sql="insert into `test`(`id`,`username`,`text`,`neirong`,`datetimes`) values(null,'$username','$text','ue',now())";
mysql_query($sql);
echo "<script>alter('添加成功!')</script>";
}
?> 展开
<table cellpadding="0" cellspacing="2" border="1" width="850" height="600" align="center">
<tr>
<td align="center" width="100"><h4>发表人:</h4></td>
<td width="750"><input type="text" name="username" value="" /></td>
</tr>
<tr>
<td align="center" width="100"><h4>标题:</h4></td>
<td width="750"><input type="text" name="text" value="" /></td>
</tr>
<tr>
<td align="center" width="100"><h4>内容:</h4></td>
<td width="750"><script id="container" name="content" type="text/plain"></script>
</td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="tianjia" value="添加"/> <input type="reset" value="重置"/></td>
</tr>
</table>
<script type="text/javascript">
var ue = UE.getEditor('container');
</script>
</form>
<?php
if(!empty($_POST['tianjia'])){
$username=$_POST['username'];
$text=$_POST['text'];
$sql="insert into `test`(`id`,`username`,`text`,`neirong`,`datetimes`) values(null,'$username','$text','ue',now())";
mysql_query($sql);
echo "<script>alter('添加成功!')</script>";
}
?> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询