jokerswild
11-19-2011, 05:30 AM
ok I am work on a application that inserts HTML that was done with CKeditor found here http://cksource.com/ckeditor pretty simple to install and seems to work great other then when i click save it removes all the HTML formatting and turns it into a blob of run together text. I have tried man different things and still nothing seems to work
any help would be great here is my code
<?php
// this starts the session
include('../../system.php');
$get_page=mysql_query("SELECT * FROM ttd_special_offers WHERE id=1") or die (mysql_error());
$r=mysql_fetch_assoc($get_page);
$html = $r['offer'];
if(isset($_POST["Submit"])){
$editor_data = $_POST[ 'offer' ];
$clean_data=htmlentities($editor_data);
$p_data=$clean_data;
$up_data="update `ttd_special_offers` SET offer='$p_data' WHERE id=1";
mysql_query($up_data) or die (mysql_error());
}
?>
<!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>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<link rel="stylesheet" type="text/css" href="../css/config.css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form action='page_manager.php?id=<?php echo $g_id ;?>' method='POST' name='offer_page'>
<input type="hidden" name="id" value="id">
<table width="100%" class="configuration" bgcolor="#F2F2F2" align="center">
<tr>
<th>Special Offers</th>
<th>
<table width="100%">
<tr>
<td align="center">
<input type="button" value="Close Configuration" onClick="window.location.replace('../frames/home.php');" name="close" class="buttonsubmit">
</td>
<td>
</td>
</tr>
</table>
</th>
</tr>
<tr>
<td width="25%" class="c_col_left" valign="top">Offer 1
</td>
<td width="75%" align="center" class="c_col_right" valign="top">
<textarea class="ckeditor" cols="60" rows="20" name="offer" id="offer"><?php echo $html ;?></textarea><script type="text/javascript">
window.onload = function()
{
CKEDITOR.replace( 'offer' );
};
</script>
</td>
</tr>
<tr>
<th width="100%" colspan="2">
<p style="text-align: center">
<input type="Submit" value="Submit" name="Submit" class="buttonsubmit">
</th>
</tr>
</table>
</form>
</body>
</html>
any help would be great here is my code
<?php
// this starts the session
include('../../system.php');
$get_page=mysql_query("SELECT * FROM ttd_special_offers WHERE id=1") or die (mysql_error());
$r=mysql_fetch_assoc($get_page);
$html = $r['offer'];
if(isset($_POST["Submit"])){
$editor_data = $_POST[ 'offer' ];
$clean_data=htmlentities($editor_data);
$p_data=$clean_data;
$up_data="update `ttd_special_offers` SET offer='$p_data' WHERE id=1";
mysql_query($up_data) or die (mysql_error());
}
?>
<!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>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<link rel="stylesheet" type="text/css" href="../css/config.css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form action='page_manager.php?id=<?php echo $g_id ;?>' method='POST' name='offer_page'>
<input type="hidden" name="id" value="id">
<table width="100%" class="configuration" bgcolor="#F2F2F2" align="center">
<tr>
<th>Special Offers</th>
<th>
<table width="100%">
<tr>
<td align="center">
<input type="button" value="Close Configuration" onClick="window.location.replace('../frames/home.php');" name="close" class="buttonsubmit">
</td>
<td>
</td>
</tr>
</table>
</th>
</tr>
<tr>
<td width="25%" class="c_col_left" valign="top">Offer 1
</td>
<td width="75%" align="center" class="c_col_right" valign="top">
<textarea class="ckeditor" cols="60" rows="20" name="offer" id="offer"><?php echo $html ;?></textarea><script type="text/javascript">
window.onload = function()
{
CKEDITOR.replace( 'offer' );
};
</script>
</td>
</tr>
<tr>
<th width="100%" colspan="2">
<p style="text-align: center">
<input type="Submit" value="Submit" name="Submit" class="buttonsubmit">
</th>
</tr>
</table>
</form>
</body>
</html>