<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'];
但是获取不到它的值,是不是我写的不对,
应该怎么写?
请教一下!
<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>这样写的话 确实可以获取到值
但是
现在这个代码是获取上个页面传过来的值
这样写的话,上个页面传过来的值就没法在这个页面获取到了
说明白点 这个是文章修改页面!
有啥办法吗?
value 里需要写什么吗?
还是?
请教!!!
如果是修改页面 刚开始进来是读取数据库里的值。然后再提交表单这样你修改的值也可以POST过去了啊。
可以获取的到啊。
如果把textare放在form里 就可以读取到数据库的值
但是POST过去的时候 无法获取到值!
我就愁这个呢!!如果把textare放在form外面的话 无法读取到数据库的值,
如果再编辑器里写内容的话,POST过去之后就可以获取到了
不明白!!!
我明白你的意思~~
之前我也没加 display:none"的textarea
但是不加的话 获取不到数据库的值
有没有什么好办法?
$oFCKeditor->Value = '………………';//这就是赋值,,,,后面fckeditor的CreateHtml()方法,会给你把值显示出来的
<?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));
?>关键是不知道语句咋写啊!
大哥!
能不能帮忙看看 怎么改?
只只能说明是你代码处理上的问题,或html结构的问题。最好把你代码完整的贴出来
<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>
代码就是这样的
具体该咋改呢?
如果放把 textarea 放在 form里 如果在check获取到 fck 的值啊!