FCK在实例中的应用

<?php
include_once("session.php");
include_once("../conn.php");


include_once('fckeditor/fckeditor.php');

  $fck->ToolbarSet = "Default";//工具按钮   

 

//创建一个FCKeditor,表单名称为 'content'
  $fck = new FCKeditor('content');
  $fck->BasePath = 'fckeditor/';
  $fck->Height = '300';

  $fck->Width= '300';
  $fck->Value = '';  //设置初始内容   
  $fckeditor = $fck->CreateHtml();

 

/*当中$fck->Create()应用为直接输出

原型为

 public function Create()
 {
  echo $this->CreateHtml() ;
 }

*/

 


 $action=$_GET["action"];
 switch($action)
 {
  case "addenpro":
  save();
  break;
 }
?>
<link href="images/css.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 { color: #FF0000;
 font-weight: bold;
}
-->
</style>
<body leftmargin="6" topmargin="6">
<table width="100%" height="11"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td background="images/top.gif"><img src="images/left_top.gif" width="10" height="11"></td>
    <td width="10"><img src="images/right_top.gif" width="10" height="11"></td>
  </tr>
</table>
<table width="100%" height="90%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="F3F3F3">
  <tr>
    <td width="6" valign="top" background="images/gncd_left.gif"></td>
    <td valign="top"><table width="90%"  border="0" align="center" cellpadding="0" cellspacing="0">
     
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>
  <form name="form1" method="post" action="?action=addenpro" >
  <table width="100%" border="0" align=center cellpadding="2" cellspacing="1" bgcolor="#69B6FF" class="tableBorder">
            <tr bgcolor="#CFE9FF">
              <th height="28" colspan="2" class="font">添加英文版产品</th>
            <tr bgcolor="#FFFFFF">
              <td width="16%" height="30" align="right" bgcolor="#E7F3FF" class="forumRow">产品名称:</td>
              <td width="84%" height="24" align="left" bgcolor="#E7F3FF" class="forumRow"><label>
              <input type="text" name="name" id="name" style="width:300px;">
              *</label></td>
            </tr>
           
            <tr bgcolor="#FFFFFF">
              <td height="30" align="right" bgcolor="#E7F3FF" class="forumRow">产品型号:</td>
              <td height="25" align="left" bgcolor="#E7F3FF" class="forumRow"><input type="text" name="xh" id="xh" style="width:300px;"></td>
            </tr>
            <tr bgcolor="#FFFFFF">
              <td height="30" align="right" bgcolor="#E7F3FF" class="forumRow">产品类别:</td>
              <td height="25" align="left" bgcolor="#E7F3FF" class="forumRow">
                <select name="fl">
                 
    <?php
    $sql="SELECT * FROM enclass ORDER BY id DESC";
    $result=mysql_query($sql);
    while($rs=mysql_fetch_array($result)){
    ?>
    <option value="<?php echo $rs["id"] ?>"><?php echo $rs["name"] ?></option>
    <?php
    }
    ?>
                </select>
    </td>
            </tr>
           
            <tr bgcolor="#FFFFFF">
              <td height="30" align="right" bgcolor="#E7F3FF" class="forumRow">产品图片:<input type="hidden" name="image" /></td>
              <td height="25" align="left" bgcolor="#E7F3FF" class="forumRow"><iframe id="pic_path" name="pic_path" src="upimage.php" width="100%" height="30" scrolling="no" frameborder="0"></iframe></td>
            </tr>
            <tr bgcolor="#FFFFFF">
              <td height="150" align="right" bgcolor="#E7F3FF" class="forumRow">描述:</td>
              <td height="25" align="left" bgcolor="#E7F3FF" class="forumRow">
                <?=$fckeditor?>
                *              </td>
            </tr>
           
            <tr bgcolor="#FFFFFF">
              <td height="25" align="right" bgcolor="#E7F3FF" class="forumRow">&nbsp;</td>
              <td height="25" align="left" bgcolor="#E7F3FF" class="forumRow">
     <input type="submit" name="Submit" value="提交">
                <input type="reset" name="Submit2" value="重置">
    </td>
            </tr>
        </table>
  </form>  </td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
    </table></td>
    <td width="6" valign="top" background="images/gncd_right.gif"></td>
  </tr>
</table>
<table width="100%" height="11"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td background="images/bottom.gif"><img src="images/left_bottom.gif" width="10" height="11"></td>
    <td width="10"><img src="images/right_bottom.gif" width="10" height="11"></td>
  </tr>
</table>
<?php
function save()
{
 $name=$_POST["name"];
 $xh=$_POST["xh"];
 $fl=$_POST["fl"];
 $image=$_POST["image"];
 $content=$_POST["content"];
 if(empty($name))
 {
  echo '<script language="javascript">location.href="error.php?action=emptyproname";</script>';
  exit;
 }
 if(empty($content))
 {
  echo '<script language="javascript">location.href="error.php?action=emptyprocontent";</script>';
  exit;
 }

//此处插入到数据库中的内容当中content是我在fck编辑器中添加的内容。
 $sql="INSERT INTO enpro (name,fl,xh,image,content) VALUES ('$name','$fl','$xh','$image','$content')";
 $result=mysql_query($sql);
 if($result)
 {
  echo '<script langauge="javascript">alert("添加产品成功!");location.href="admin_enpro.php";</script>';
 }
 else
 {
  echo '<script language="javascript">location.href="error.php?action=errorconnect";</script>';
  exit;
 }
}
?>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值