I'm trying to integrate a rich text editor to my site. Here is the sample code of the free editor i got: <?php 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("<i>This is some <b><br>preloaded</b> content</i>") ?> <form method="get"> <!-- Include the Free Rich Text Editor Runtime --> <script src="../js/richtext.js" type="text/javascript" language="javascript"></script> <!-- Include the Free Rich Text Editor Variables Page --> <script src="../js/config.js" type="text/javascript" language="javascript"></script> <!-- Initialise the editor --> <script> initRTE('<?= $content ?>', 'example.css'); </script> <input type="submit"> </form> Code (markup): I can add the editor but i just don't know how to extract the data that is entered into the editor and save into my DB. Can someone point me in the right direction? Rep will be given for any useful tips!
hello, this the code using POST method instead of GET. <?php 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("<i>This is some <b><br>preloaded</b> content</i>") ?> <form method="post" action="post.php"> <!-- Include the Free Rich Text Editor Runtime --> <script src="../js/richtext.js" type="text/javascript" language="javascript"></script> <!-- Include the Free Rich Text Editor Variables Page --> <script src="../js/config.js" type="text/javascript" language="javascript"></script> <!-- Initialise the editor --> <script> initRTE('<?= $content ?>', 'example.css'); </script> <input type="submit"> </form> PHP: and this one is post.php file <?php $content = $_POST['freeRTE_content']; echo $content; ?> PHP: So, you can modify post.php file as how you want to process the data.. Thanks for your rep. Regards.
tks mehmetm, but that's not my problem. my problem is, i don't know how to reference the data typed into the editor. What variable do i use? How do i execute a mysql query to pump the data into the db when there is no variable? anyway, rep given, hope you can help further
I think, I has given the information you need. So, the variable which has been passed through the editor file is 'freeRTE_content'. I prepared a post.php file and sent it the previous post. In post.php file I just declare a new variable called $content and assign the value in $_POST['freeRTE_content'] to it. ($_POST['freeRTE_content'] contains the posted data typed into the editor) After all, you can use the $content variable however you want to use. For example: mysql_query("INSERT INTO table (column) VALUES ('$content')"); Code (markup): I hope, I was clear Regards..
tks for the assistance. i've hired a coder to do it. there is a config file where i cld just set the name of the RTE and then use it closed.