Hi All,
I am stuck. I have some javascript code for 'FreeRichTextEditor' which is a WYSIWYG editor for a textarea, and I cannot seem to retain the SESSION data for it if you either go back with the back button or my script to go back (java 'javascript:history.go(-1)') and its not the java, its my PHP.
NOTE: this form is one page. I check for SUBMIT at the start, then process if isset
if(isset($_POST['Submit'])) {
rest of the code
Here is the function for the RTF editor...
function freeRTE_Preload($content) {
// Strip newline characters.
$content = str_replace(chr(10), " ", $content);
$content = str_replace(chr(13), " ", $content);
// Replace single quotes.
$content = str_replace(chr(145), chr(39), $content);
$content = str_replace(chr(146), chr(39), $content);
// Return the result.
return $content;
}
// Send the preloaded content to the function.
$content = freeRTE_Preload("");
//then call it in my form
<script src="http://www.site/staff/includes/js/richtext.js" type="text/javascript" language="javascript"></script>
<!-- Include the Free Rich Text Editor Variables Page -->
<script src="http://www.site/staff/includes/js/config.js" type="text/javascript" language="javascript"></script>
<!-- Initialise the editor -->
<script>
initRTE('<?php echo $content; ?>', 'example.css');
</script>
Now, if I I hit Submit, with this code at the beginning. (I entered 'test' in the description text field).
echo '1) '.$description.'<br>';
$description = $_SESSION['description'];
echo '2) '.$description.'<br>';
I get...
1) test
2)
Then if I go back, I get...
1)
2)
So the description was there, then calling the SESSION['description'] cleared it.
How can I retain this, or is it not possible because this is a javascript app?
Thanks as always,
Don