1

PHP Version 5.3.3-1 Ubuntu 10.10 Apache 2.2

Ckeditor 3.6.1

I can edit and save but the web page I am editing does not update ? The edited text appears in a new window. I want the web page I am editing to be updated.

ckeditor.js, test.html and posteddata.php are all in the same directory /var/www/

test.html

< head>
  < title>Test Page < /title >
  < meta http-equiv="content-type" content="text/html; charset=utf-8"/ >
  < script type="text/javascript" src="ckeditor.js">< /script >
< /head >
< body >
< form action="posteddata.php" method="post" >
< textarea id="editor1" name="editor1" >
&lt;p&gt;Your text goes here&lt;/p&gt;
< /textarea>
< script type="text/javascript" >
window.onload = function()
{CKEDITOR.replace( 'editor1' );};
 < /script>
< input type="submit" value="Submit"/ >
< /form>
< /body>
< /html>

posteddata.php

< ?php
if ( isset( $_POST ) )
$postArray = &$_POST ;          // 4.1.0 or later, use $_POST
else
$postArray = &$HTTP_POST_VARS ; // prior to 4.1.0, use HTTP_POST_VARS
foreach ( $postArray as $sForm => $value )
{
if ( get_magic_quotes_gpc() )
    $postedValue = htmlspecialchars( stripslashes( $value ) ) ;
else
    $postedValue = htmlspecialchars( $value ) ; ?>
    < tr>
        < th style="vertical-align: top"><?php echo htmlspecialchars($sForm); ?>
< /th>
        < td><pre class="samples"><?php echo $postedValue?></pre></td>
    < /tr>



< ?php }
?>  
1
  • Sounds like you are asking the people on SO to design and write the entire feature for you. This is not a site for those things, unless you really don't have any starting point. If you do, accept either of the two existing answers. If you have any further issues related to this question, please comment or edit the question. Aug 1, 2013 at 9:47

2 Answers 2

0

All your code does is print out what you've just typed in. It doesn't save it anywhere.

Probably the simplest way is to store the changes in a database and then load them each time.

Here's a tutorial; worth reading if you want to do anything useful in PHP: http://www.w3schools.com/php/php_mysql_intro.asp

0

There is a "save" plugin that submits the form. Get the submitted form and save it in your DB or on your file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.