Jump to content

Value from FCK editor to show preview


Sajesh Mohan

Recommended Posts

my issue is to show preview of a form. the form will have a fck editor  . this form is used to update a table. i need to show a preview button on this page and when we click on it  should show the preview of the content. i am attaching my code. my problem is this is a update page fck value is taken from Dn "$desc" . when do some changes on editor then i click on preview button should show the changes, here showing only the $dec value from DB not the value i change.

 

 

<?php

session_start();

$uname=$_SESSION['usname'];

include("dbconnect.php");

$admin_qry="select * from st_admin where admin_username='$uname'";

$res=mysql_query($admin_qry);

$admin_res=mysql_fetch_array($res);

$level=$admin_res['level'];

include("status.php");

 

?>

<script language="javascript" src="ajax/ajax.js"></script><?php

$pos=$_REQUEST['pos2'];

$getqry="select * from st_aboutus where categorys='$pos'";

$resr=mysql_query($getqry);

$row=mysql_fetch_array($resr);

$cat=$row['categorys'];

$img=$row['st_img'];

//$description=$row['st_content'];

$desc=stripslashes($row['st_content']);

$file_name=$row['file_name'];

$id=$row['st_id'];

 

?>

<script language="javascript">

function popUpPreview()

{

  // Display a new browser for the user

  var w  = screen.availWidth / 2 - 450;

  var h  = screen.availHeight / 2 - 320;

  var win = window.open('aboutus-prewiew.php', 'payPopupMain', 'width=900,height=650,left='+w+',top='+h+',scrollbars=1');

 

</script>

<link href="../css/style.css" rel="stylesheet" type="text/css" />

 

 

<form name="sform" id="sform" action="update_aboutus.php"  method="post">

  <table width="679" height="323" border="0" align="center" cellpadding="0" cellspacing="0" >

<tr>

      <td colspan="5" height="40" align="left" class="page_head" valign="top"> </td>

    </tr> 

    <tr>

      <td align="left" class="textfont"> </td>

      <td align="left" class="textfont"> </td>

      <td height="40" align="left"> </td>

      <td height="40" align="left" class="normaltext"><?php if($level=="dataentry" ){} else {echo " Status " ; } ?></td>

      <td align="left"><span style="padding-left:10px;">

      <?php if($level=="dataentry" ){} else {  showStatus('st_aboutus','st_id','status',$id) ;  }  ?>

       

      </span></td>

    </tr>

    <tr>

    <td width="170" align="left" class="textfont"> </td>

    <td width="8" align="left" class="textfont"> </td>

    <td height="40" colspan="3" align="left"><?php

  echo $message=$_GET[msg];

  ?></td>

 

  </tr>

  <tr>

    <td height="19" class="listitem" align="right"> </td>

    <td class="listitem" align="left"> </td>

    <td height="19" align="left" class="listitem1">Image Size 274 X 420</td>

    <td colspan="2" align="left"></td>

  </tr>

  <tr>

    <td height="71" class="listitem" align="right">Add Image</td>

    <td class="listitem" align="left"> </td>

    <td width="236" height="71" align="left"><input name="logo" type = "text" id="logo" value="<?php echo $img; ?>" size="20" readonly="readonly" class="txtbox" />

    <img src="../images/attach.gif" onClick="attachment('logo','logoimage')" class="imagebutton12" /> <img src="../images/remove.gif" onClick="removeattachment('logo','logoimage')" class="imagebutton12" /></td>

    <td width="265" colspan="2" align="left"><img src="<?php if($img) {echo "aboutus/".$img; } else { echo "../images/photo.gif "; } ?>" width="67" height="62" name="logoimage8" id="logoimage" />

      <input type="hidden" name="image1_hiid" id="image1_hiid" value="<?php echo $img; ?>" /></td>

  </tr>

 

<tr>

      <td  colspan="5" align="left" class="optimumSize" valign="bottom"><!--Optimum size of image is 120 X 105 --></td>

    </tr>

 

    <tr>

      <td height="10" colspan="2" class="textfont"> </td>

      <td height="10" colspan="3"><?php  include("../FCKeditor/fckeditor.php");

$oFCKeditor = new FCKeditor('desc') ;

        $oFCKeditor->BasePath = '../FCKeditor/';

        /* $oFCKeditor->Value =stripslashes(substr($intro,0,500));*/

        $oFCKeditor->Value = $desc; 

// here we can give size of editor as

        $oFCKeditor->Width  = '600' ;

        $oFCKeditor->Height = '250' ;

        $oFCKeditor->Create() ;

 

?></td>

    </tr>

    <tr>

      <td height="27" align="right" class="listitem"> </td>

      <td height="27" class="textfont"> </td>

      <td height="27" align="left" valign="bottom"><span class="listitem1"><?php /*?><?php if($pos!="management" ){} else {echo " Only Upload ".pdf" file";} ?><?php */?></span></td>

      <td height="27" colspan="2" align="left"> </td>

    </tr>

    <?php /*?><?php if($pos!="management" ){} else {echo "

    <tr>

    <td height='68' align='right' class='listitem'>Update pdf</td>

    <td height='68' class='textfont'> </td>

    <td height='68' align='left'>

        <input name='logo1' type = 'text' id='logo1' value='$file_name' size='20' readonly='readonly' class='txtbox' />

      <img src='../images/attach.gif' onclick=\"attachment('logo1','logoimage1')\" class='imagebutton12' /> <img src='../images/remove.gif' onclick=\"removeattachment('logo1','logoimage1')\" class='imagebutton12' /></td>

    <td height='68' align='left'><img src=\"aboutus/$file_name\" width='67' height='62' name='logoimage1' id='logoimage1' /></td>

  </tr> ";} ?><?php */?>

 

    <tr>

      <td height="36" colspan="2"><input type="hidden" name="des" id="des" value="<?php echo $img; ?>" /></td>

      <td align="left"><input name="preview" type="button" onclick="return popUpPreview();" value="Preview"/></td>

      <td colspan="2"> </td>

    </tr>

    <tr>

    <td colspan="2"><input type="hidden" name="id" value="<?php echo $id; ?>"><input type="hidden" name="pos" value="<?php echo $pos; ?>">

      <input type="hidden" name="image1_hiid1" id="image1_hiid1" value="<?php echo $file_name; ?>" /></td>

    <td align="left">

      <input type="image" name="image" value="Submit" src="../images/submit.gif" alt="Login Details" title="Submit" onclick="return fieldcheck(this.form);"></td>

    <td colspan="2"> </td>

  </tr>

  <tr><td colspan="5" height="10"></td></tr>

 

</table>

</form>

 

aboutus-prewiew.php

 

<script type="text/javascript">

  document.write(opener.document.sform.logo.value);

    document.write(opener.document.sform.desc.value);    // this value only showing from the database ,i need to get the value to show preview

 

</script>

Link to comment
https://forums.phpfreaks.com/topic/261796-value-from-fck-editor-to-show-preview/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.