Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6533507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:08:07+00:00 2026-05-25T10:08:07+00:00

I’ve searched high and low both on Google and this site for an answer

  • 0

I’ve searched high and low both on Google and this site for an answer to this question with no luck.

I’m working on a custom CMS for future customers who want to do their own maintenance. Here’s the code that loads the current page content into the textarea from the database:

if(isset($_GET['id'])) {
    $id = $_GET['id'];
    $content = mysql_query("SELECT title, content FROM pages WHERE id=".$id);
    $search = mysql_num_rows($content);
    if($search > 0){
        while($page = mysql_fetch_array($content)) { ?>
        <h1>Editing <?php echo $page['title']; ?></h1>
    <form id="editform" action="save.php?id=<?php echo $_GET['id']; ?>" method="post">
    <textarea id="editor" name="content"><?php echo $page['content']; ?></textarea>
    </form>
<?php } 
    }
} ?>

Here’s the code in save.php:

<?php
if(isset($_POST['content'])){
$content = $_POST['content'];
$id = $_GET['id'];

echo $content;

mysql_query("UPDATE pages SET content=".$content." WHERE id=".$id);
}
?>

The problem is that the POST[‘content’] keeps getting the original content, not the edited one that the user just submitted.

How do I fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:08:08+00:00Added an answer on May 25, 2026 at 10:08 am

    The data should be passed automatically when the form is posted. Here is the “Integration” page page from the Developers Guide that explains this:
    http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Integration

    Are you sure that the query is being run successfully and that the content field is being updated? I ask because the code you posted says that in save.php, you are using:

    $id = $_GET['id'];
    

    This would seem to cause a problem, because you are using method=”post” in your form, not method=”get”.

    Could you also post the code you are using to replace the textarea with CKEditor. Are you using the PHP method:

    <?php
    $CKEditor = new CKEditor();
    $CKEditor->basePath = '/ckeditor/';
    $CKEditor->replace("content");
    ?>
    

    Or the JavaScript method:

    <script language="Javascript">
    <!--
      CKEDITOR.replace( 'content' );
    //-->
    </script>
    

    Be Well,
    Joe


    Follow up to question in comments

    Hi Purmou,

    I didn’t notice that you were including the id in the form action, sorry about that. If you did want to use it as a $_POST variable instead, you could include it as a hidden field like this:

    <form id="editform" action="save.php?id=<?php echo $_GET['id']; ?>" method="post">
    <input type="hidden" id="id" name="id" value="<?php echo $_GET['id']; ?>" />
    <textarea id="editor" name="content"><?php echo $page['content']; ?></textarea>
    

    There is some good documentaion about loading the editor via PHP in the _samples folder of the CKEditor install:
    http://YourSite.com/ckeditor/_samples/php/

    http://YourSite.com/ckeditor/_samples/php/replace.php, has the basic settings:

    <?php
    // Include the CKEditor class.
    include_once "ckeditor/ckeditor.php";
    
    // Create a class instance.
    $CKEditor = new CKEditor();
    
    // Path to the CKEditor directory.
    $CKEditor->basePath = '/ckeditor/';
    
    // Replace a textarea element with an id (or name) of "textarea_id".
    $CKEditor->replace("textarea_id");
    ?>
    

    Similar to the JavaScript method, you can add config options before you replace the textarea. An example from the “advanced.php” file:

    $CKEditor->config['width'] = 600;
    

    To use the PHP method with your specific code, do this:

    if(isset($_GET['id'])) {
        $id = $_GET['id'];
        $content = mysql_query("SELECT title, content FROM pages WHERE id=".$id);
        $search = mysql_num_rows($content);
        if($search > 0){
            while($page = mysql_fetch_array($content)) { ?>
            <h1>Editing <?php echo $page['title']; ?></h1>
        <form id="editform" action="save.php?id=<?php echo $_GET['id']; ?>" method="post">
        <textarea id="content" name="content"><?php echo $page['content']; ?></textarea>
        </form>
    <?php }
    
    include_once "ckeditor/ckeditor.php";
    $CKEditor = new CKEditor();
    $CKEditor->basePath = '/ckeditor/';
    $CKEditor->replace("content");
    
        }
    } ?>
    

    I changed the textarea id from “editor” to “content”. I would recommend against using “editor” for the id or name, because it’s used in the CKEditor code to refer to the CKEditor instance.

    You can do config settings in the page where you load the editor or in the config.js file or in your own custom config file.

    I spent some time trying to catch the value of the form content field after the form is submitted, but was only able to see it before CKEditor had updated the contents.

    Be Well,
    Joe

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string
I am writing an app with both english and french support. The app requests

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.