Not sure how to make myself clear here, but, I'm using FCKeditor to add & edit data to/from a data base. When editing, he edited data is saved, but on the success page, the old data shows up. The success page is an action on a php page. Here's the code :
<body>
<div class="center"><h1>News Editor - Welcome <?php echo $_SESSION['SESS_FIRST_NAME'];?></h1>
<a href="newsAddNew.php">Add News Item</a> | <a href="newsEditor.php">Back To News Editor</a> | <a href="index.php">Admin</a> | <a href="logout.php">Logout</a></div>
<br /><br />
<?php
// Page: act=edit&id=##
$result = mysql_query("SELECT * FROM $mysql_table
WHERE id='$request_id'");
while($row = mysql_fetch_array($result)){
echo "
<!-- Wrap -->
<div id=\"wrap\">
<!-- Tables -->
<div id=\"tables\">
<form name=\"form\" method=\"post\">
<div class=\"left\"><strong>Title:</strong></div>
<div class=\"right\"><input name=\"news_name\" type=\"text\" id=\"news_name\" value=\"".$row['news_name']."\" size=\"40\" /></div><br />
<div class=\"clear\"></div>
<div class=\"left\"><strong>News:</strong></div>
<div class=\"clear\"></div>
<div>
<textarea name=\"news_item\" cols=\"65\" rows=\"10\">".$row['news_item']."</textarea></div><br />
<div class=\"clear\"></div>
<div class=\"center\"><input name=\"submit\" type=\"submit\" id=\"submit\" value=\"Edit\" /></div>
</form>
<!-- EndTables -->
</div>
<!-- End Wrap -->
</div>
<script type=\"text/javascript\">
window.onload = function()
{
var sBasePath =\"fckeditor/\" ;
var oFCKeditor = new FCKeditor( 'news_item' ) ;
oFCKeditor.BasePath = sBasePath ;
oFCKeditor.ToolbarSet = 'Basic' ;
oFCKeditor.ReplaceTextarea() ;
}
</script>
";
if ($_POST['submit']) {
$news_name = ($_POST['news_name']);
$news_item = ($_POST['news_item']);
mysql_query("UPDATE $mysql_table SET news_name='$news_name', news_item='$news_item'
WHERE id='$request_id'") or die('Sorry, it failed');
echo "<div id=\"wrap\">Success! Your news item has been edited.</div>
";
}
}
// End edit
?>
</body>Any one know why the data isn't updated in the editor on the success page?