Hi,
I have a small self designed CMS (php, MySQL) that I use 1.6 on to manage news articles, FAQ's, etc. This works perfectly.
When I try to edit an existing FAQ or News Article (in the management backend) FCKeditor does not include the HTML that is pulled from the DB.
My code is as follows:
The $atext does not display (However, if i change it to $qtext, this displays - This is not input via FCK - just a normal input box)
I have tried
$repchar = array("\"","\'", ",");
$atext = str_replace($repchar, "", $atext);
and
$atext = htmlspecialchars($atext, ENT_QUOTES)
after reading one of the articles here, but to no avail.
Any assistance greatly appreciated.
cheers
HM
I have a small self designed CMS (php, MySQL) that I use 1.6 on to manage news articles, FAQ's, etc. This works perfectly.
When I try to edit an existing FAQ or News Article (in the management backend) FCKeditor does not include the HTML that is pulled from the DB.
My code is as follows:
<? $query = "SELECT id, question, answer FROM faq WHERE id = '$_GET[faqid]'"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); list($qid, $qtext, $atext) = mysql_fetch_row($result); ?>
<html>
<head>
<script type="text/javascript" src="FCKeditor/fckeditor.js"></script>
</head>
<body>
<table border="0" cellspacing="5" cellpadding="2">
<form action="editfaq.php" method="POST">
<input type=hidden name="faqid" value="<?=$qid?>">
<tr>
<td width=20%><p><b>The Question You Want To Ask<font color="red">*</font></b></p></td>
<td><input type="text" value="<?=$qtext?>" name="faqquestion" size="100"></td>
</tr>
<tr>
<td width=20%><p><b>The Answer<font color="red">*</font></b></p></td>
<td>
<script type="text/javascript">
<!--
var oFCKeditor = new FCKeditor('faqanswer');
oFCKeditor.ToolbarSet = 'Accessibility' ;
oFCKeditor.BasePath = 'FCKeditor/';
oFCKeditor.Value = '<?=$atext?>';
oFCKeditor.Height = '200';
oFCKeditor.Width = '80%';
oFCKeditor.Create();
//-->
</script>
</td>
</tr>
<tr>
<td align=center colspan=3>
<input type="submit" name="submit" value="Edit This FAQ">
</td>
</tr>
</table>
</form>
</body>
</html>
The $atext does not display (However, if i change it to $qtext, this displays - This is not input via FCK - just a normal input box)
I have tried
$repchar = array("\"","\'", ",");
$atext = str_replace($repchar, "", $atext);
and
$atext = htmlspecialchars($atext, ENT_QUOTES)
after reading one of the articles here, but to no avail.
Any assistance greatly appreciated.
cheers
HM
RE: Loading HTML Generated From A MySQL query
PS: If I <? echo $atext?>, I get the required text on the screen
RE: Loading HTML Generated From A MySQL query
The editor likes to receive the HTML source all on one line, and quotes need to be escaped. So I use the following function:
oFCKeditor.Value = '<?= stripLineEnds($atext) ?>';