Does anyone use FCKeditor or anything similiar?
I am struggling to get this working, I am thinking I am going about this the wrong way ??
Pages_Table
page_id | page_name
Content Table
content_id | page_id | content
In my CMS I have a page that I insert entries into the pages_table. (pages on the website that I want to use the FCKeditor on.
I then added a page that has a dropdown list, this pulls a list of pagenames from the pages table getting the 'page_id'. The form sends you to the next page with the FCKeditor, in effect pulling the data / html from the content_table for the relevant 'page_id'
Ok...
So what the problem is if there isnt an entry for the page_id, nothing is displayed?
Another problem I am sure I will face is to Update or insert 🙁
<?php
$query = mysql_query("SELECT * FROM CMS_content WHERE page_id='$_GET[page]'");
while($r = mysql_fetch_assoc($query))
{
?>
<br /><br />
<form action="pages-edit-process.php" method="post">
<?php
$content = "$r[content]";
// Adjust HTML Tags
$pagecontent = html_entity_decode ($content);
$oFCKeditor = new FCKeditor("$_GET[page]");
$oFCKeditor->BasePath = '../../fckeditor/';
$oFCKeditor->Value = "$pagecontent";
$oFCKeditor->Width = '100%' ;
$oFCKeditor->Height = '300' ;
$oFCKeditor->Create();
?>
<br / >
<input type="submit" value="Submit">
</form>
</div>
<?
} // end of while statemnt
?>
The code that processes this:
# this is processed when the form is submitted
# back on to this page (POST METHOD)
if ($REQUEST_METHOD=="POST") {
# setup SQL statement
$SQL = " UPDATE CMS_content SET content ='$postedValue' WHERE page_id='$sForm' ";
#execute SQL statement
$result = mysql_db_query($db,"$SQL",$cid);
# check for error
if (!$result) { echo("ERROR: " . mysql_error() . "\n$SQL\n"); }
echo ("<P align=center><font class=menu><b>The new data has been added!</b></font></P>\n");
}
mysql_close($cid);
Can anyone make any sense of this?
Any advice would be GREATLY appreciated.