关于FCKeditor 获取值的问题!!!请教一下!

hh022406 2010-08-06 10:14:26

<div class="editor">
<textarea name="art_cnn" id="art_cnn" style="display:none" ><?php echo $row[4] ?></textarea>
<?php
include_once("fckeditor/fckeditor.php");
$oFCKeditor=new fckeditor('art_cnn');
$oFCKeditor->BasePath='fckeditor/';
$oFCKeditor->value='';
$oFCKeditor->Width='850px';
$oFCKeditor->Height='500px';
$oFCKeditor->create();
//$fck=$oFCKeditor->CreateHtml();
?>
</div>


这个 textarea 和 fckeditor 是捆绑一起的,
check的时候 我这样写 $art_cnn=$_POST['art_cnn'];
但是获取不到它的值,是不是我写的不对,
应该怎么写?
请教一下!
...全文
498 18 打赏 收藏 转发到动态 举报
写回复
用AI写文章
18 条回复
切换为时间正序
请发表友善的回复…
发表回复
duanyuyao 2011-04-25
  • 打赏
  • 举报
回复
我解决了。。。
duanyuyao 2011-04-25
  • 打赏
  • 举报
回复
哥。这玩意你解决没??我也遇到啦!!求指教!!
hh022406 2010-08-06
  • 打赏
  • 举报
回复
求救,求救!!!!!
hh022406 2010-08-06
  • 打赏
  • 举报
回复
大哥,别沉啊~~!
如果放把 textarea 放在 form里 如果在check获取到 fck 的值啊!
zlcqupt 2010-08-06
  • 打赏
  • 举报
回复


hh022406 2010-08-06
  • 打赏
  • 举报
回复


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>邮宝宝文章管理</title>

<!-- CSS -->
<link href="style/css/transdmin.css" rel="stylesheet" type="text/css" media="screen" />
<!--[if IE 6]><link rel="stylesheet" type="text/css" media="screen" href="style/css/ie6.css" /><![endif]-->
<!--[if IE 7]><link rel="stylesheet" type="text/css" media="screen" href="style/css/ie7.css" /><![endif]-->

<!-- JavaScripts-->
<script type="text/javascript" src="style/js/jquery.js"></script>
<script type="text/javascript" src="style/js/jNice.js"></script>
<script type="text/javascript" src="/FCKeditor/fckeditor.js"></script>
<script language="javascript">
function act(){
if (art.art_nmt.value==""){
alert("文章标题不能为空!")
art.art_nmt.focus;
return false;
}
if (art.art_aut.value==""){
alert("作者不能为空!")
art.art_aut.focus;
return false;
}
}
</script>
</head>

<body>

<div id="wrapper">
<!-- h1 tag stays for the logo, you can use the a tag for linking the index page -->
<h1> </h1>

<!-- You can name the links with lowercase, they will be transformed to uppercase by CSS, we prefered to name them with uppercase to have the same effect with disabled stylesheet -->
<ul id="mainNav">
<li><a href="index.php" >文章管理首页</a></li> <!-- Use the "active" class for the active menu item -->
<li><a href="write.php">写新文章</a></li>
<li><a href="artical_list.php">文章列表</a></li>
<li><a href="#">更多>></a></li>
<li class="logout"><a href="#">退出</a></li>
</ul>
<!-- // #end mainNav -->

<div id="containerHolder">
<div id="container">
<!-- // #sidebar -->
<!-- h2 stays for breadcrumbs -->
<h2><a href="index.php">文章管理首页</a> » <a href="#" class="active">写新文章</a></h2>

<div id="main">
<h3>文章列表</h3>
<?php
$id=$_GET['id'];
$link=@mysql_connect("localhost","root","root") or die ("数据库链接失败".mysql_error());
mysql_select_db("art",$link);
header("Content-type: text/html;charset=gb2312");
mysql_query("set names 'gb2312'");
$sql="select * from art_bse where id=".$id;
$row=mysql_fetch_row(mysql_query($sql));
?>

<form action="art_edit_chk.php?id=<?php echo $row['$id'];?>" method="post" enctype="multipart/form-data" onSubmit="return act();" name="art">
<table width="100%" height="30" cellpadding="0" cellspacing="0">
<tr>
<td width="675" height="20" class="pp">文章标题:
<input type="text" name="art_nmt" value="<?php echo $row[1];?>" />
作者:
<input name="art_aut" type="text" id="art_aut" size="10" value="<?php echo $row[2];?>" />
<input type="hidden" name="art_dtc" value="<?php echo date("Y-m-d");?> "/>
</td>

<td width="173" align="left" class="action">
<h5>
<input type="submit" name="Submit" value="保存" />
     
<input type="reset" name="Submit2" value="取消" />
</h5> </td>
</tr>
<tr>
</table>
<div class="editor">
<?php
include_once("fckeditor/fckeditor.php");
$oFCKeditor=new fckeditor('art_cnn');
$oFCKeditor->BasePath='fckeditor/';
$oFCKeditor->Value='';
$oFCKeditor->Width='850px';
$oFCKeditor->Height='500px';
$oFCKeditor->create();
//$fck=$oFCKeditor->CreateHtml();
?>

</div>
</form>
<textarea name="art_cnn" id="art_cnn" style="display:none" ><?php echo $row[4] ?></textarea>
<fieldset><h3>中华邮宝宝,非集邮的集邮平台!</h3></fieldset>

</div>
<!-- // #main -->

<div class="clear"></div>
</div>
<!-- // #container -->
</div>
<!-- // #containerHolder -->

<p id="footer">版权所有:中华邮宝宝. <a href="http://www.china-ybb.com">China-ybb.</a></p>
</div>
<!-- // #wrapper -->
</body>
</html>


代码就是这样的
具体该咋改呢?
Dleno 2010-08-06
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 hh022406 的回复:]

现在这个代码是获取上个页面传过来的值
这样写的话,上个页面传过来的值就没法在这个页面获取到了
说明白点 这个是文章修改页面!
[/Quote]

只只能说明是你代码处理上的问题,或html结构的问题。

最好把你代码完整的贴出来
hh022406 2010-08-06
  • 打赏
  • 举报
回复

<?php
$id=$_GET['id'];
$link=@mysql_connect("localhost","root","root") or die ("数据库链接失败".mysql_error());
mysql_select_db("art",$link);
header("Content-type: text/html;charset=gb2312");
mysql_query("set names 'gb2312'");
$sql="select * from art_bse where id=".$id;
$row=mysql_fetch_row(mysql_query($sql));
?>



关键是不知道语句咋写啊!
大哥!
能不能帮忙看看 怎么改?
amani11 2010-08-06
  • 打赏
  • 举报
回复
取不到数据库的值,那是你前面数据库语句的问题


$oFCKeditor->Value = '………………';//这就是赋值,,,,

后面fckeditor的CreateHtml()方法,会给你把值显示出来的
hh022406 2010-08-06
  • 打赏
  • 举报
回复

我明白你的意思~~
之前我也没加 display:none"的textarea
但是不加的话 获取不到数据库的值
有没有什么好办法?
tbraz 2010-08-06
  • 打赏
  • 举报
回复
路过学习了……
amani11 2010-08-06
  • 打赏
  • 举报
回复
$oFCKeditor->Value = '………………';

这就是对fckeditor赋值了,你不需要一个="display:none"的textarea
hh022406 2010-08-06
  • 打赏
  • 举报
回复
是啊,就是修改页面~!
如果把textare放在form里 就可以读取到数据库的值
但是POST过去的时候 无法获取到值!
我就愁这个呢!!

如果把textare放在form外面的话 无法读取到数据库的值,
如果再编辑器里写内容的话,POST过去之后就可以获取到了


不明白!!!
无笔秀才 2010-08-06
  • 打赏
  • 举报
回复
你是说修改页面 读取数据库里的值吗?
如果是修改页面 刚开始进来是读取数据库里的值。然后再提交表单这样你修改的值也可以POST过去了啊。
可以获取的到啊。
hh022406 2010-08-06
  • 打赏
  • 举报
回复
$oFCKeditor->Value=''
value 里需要写什么吗?
还是?
请教!!!
amani11 2010-08-06
  • 打赏
  • 举报
回复
$oFCKeditor->value='';

修改需要赋值,默认大写的 $oFCKeditor->Value,除非你改过
hh022406 2010-08-06
  • 打赏
  • 举报
回复

<div class="editor">

<?php
include_once("fckeditor/fckeditor.php");
$oFCKeditor=new fckeditor('art_cnn');
$oFCKeditor->BasePath='fckeditor/';
$oFCKeditor->value='';
$oFCKeditor->Width='850px';
$oFCKeditor->Height='500px';
$oFCKeditor->create();
//$fck=$oFCKeditor->CreateHtml();
?>
</div>
</form>
<textarea name="art_cnn" id="art_cnn" style="display:none" ><?php echo $row[4] ?></textarea>

这样写的话 确实可以获取到值
但是
现在这个代码是获取上个页面传过来的值
这样写的话,上个页面传过来的值就没法在这个页面获取到了
说明白点 这个是文章修改页面!
有啥办法吗?
CunningBoy 2010-08-06
  • 打赏
  • 举报
回复
<textarea>外面要加form才行。
此文档的目录结构: 1 FCKeditor的下载及介绍 4 1.1 下载地址 4 1.2 FCKeditor下载包的介绍 4 2 FCKeditor的目录和文件精简 4 3 在页面创建FCKeditor 4 3.1 Js创建FCKeditor实例: 4 3.1.1 方法一:内嵌方法(推荐) 4 3.1.2 方法二:替换页面中的Textarea 5 3.1.3 方法三:适合于Ajax的调用方法 6 3.1.4 Js中FCKeditor对象的属性(集合)和方法 6 3.1.4.1 属性 6 3.1.4.2 集合 7 3.1.4.3 方法 7 3.1.5 FCKeditor的JS构造器 9 3.1.6 将从后台读取的数据显示在FCKeditor中 9 3.2 在Jsp中通过自定义标签创建: 9 3.3 FCKeditor API 调用 10 3.4 适时打开编辑器 10 4 修改FCKeditor的配置: 11 4.1 方法一:修改fckconfig.js 文件 11 4.2 方法二:使用一个额外的配置文件覆盖默认配置 11 4.3 配置的加载顺序 11 4.4 提示 11 4.5 一般需要修改的配置项 11 4.5.1 默认语言 11 4.5.2 自定义ToolbarSet, 去掉一些不需要的功能 12 4.5.3 加上几种常用的字体 13 4.5.4 修改“回车” 和 “Shift + 回车”的换行行为 13 4.5.5 修改编辑区的样式文件 14 4.5.6 更换表情图片 14 4.5.7 编辑区域的右键菜单功能 14 4.6 fckconfig.js配置参数选项说明 15 4.7 自定义工具栏按钮 17 4.8 自定义右键菜单 18 5 文件上传问题 19 5.1 开启和关闭文件上传功能(fckconfig.js) 19 5.2 文件上传的基本使用 19 5.3 上传中文文件名的文件会出现乱码 20 5.4 创建中文名目录会出现乱码 21 5.5 引用中文名文件的图片不能正常显示 21 5.6 控件允许上传的文件的类型 22 5.7 控制上传的文件的大小 22 5.8 增加文件删除功能 23 6 超连接重定位问题 25 7 使用FCKeditor的API 26 7.1 得FCKeditor的实例 26 7.1.1 得当前页FCKeditor实例 26 7.1.2 从FCKeditor的弹出窗口中得FCKeditor实例 26 7.1.3 从框架页面的子框架中得其它子框架的FCKeditor实例 26 7.1.4 从页面弹出窗口中得父窗口的FCKeditor实例 26 7.2 常见的Js方法调用 27 7.2.1 插入HTML到FCKeditor 27 7.2.2 设置FCKeditor的内容(HTML) 27 7.2.3 取FCKeditor中的XHTML 27 7.2.4 取FCKeditor中的innerHTML和innerText 27 7.2.5 执行指定动作 28 7.2.6 统计编辑器中内容的字数 29 7.2.7 检查FCKeditor中的内容是否有改动 29 7.2.8 将FCKeditor中的内容是否有改动的值重新设置 29 8 外联编辑条(多个编辑域共用一个编辑条) 29 9 解释fck样式(CSS)的工作原理 30 10 取FCKeditor中插入的图片 31

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧