0

I am trying to get the ckeditor working. The editor shows up and displays the textarea content, but on submit the form doesn't submit the text in the editor.

relevant code:

<body onload="load_ck_editor();">

i'm using php:

    echo '<form action="' . URL . '/admin/editlistings.php?id=' . intval($_GET['id']) . '" method="POST" name="form">

<table width="100%" cellpadding="5" cellspacing="0" border="0">';


echo '
    <script type="text/javascript" src="' . URL . '/includes/ckeditor/ckeditor.js">/script>
    <script type="text/javascript">
    function load_ck_editor() {
    document.form.description.value = document.form.description.value.replace(/\n/g,"<br>");
    CKEDITOR.basePath = "' . URL . '/includes/ckeditor/";
    CKEDITOR.config.MaxLength = 99999;
    CKEDITOR.config.width = "600";                   
    CKEDITOR.config.height = "350";
    CKEDITOR.replace("description");
    CKEDITOR.instances.description.setData( \''.str_replace('"', '\"', stripslashes($form['description'])).'\' );
    }
    </script>';

(...)

// If the Submit button was pressed we start this routine
if (isset($_POST['submit_listing']) && $_POST['submit_listing'] == $lang['Listing_Submit']) {
$form = array();
// safehtml() all the POST variables to insert into the database
// or print the form again if errors found
$form = array_map('safehtml', $_POST);
// Cut the description size to the one set in the configuration
// just in case the java Script is disabled in user browser
$form['description'] = substr ($form['description'], 0, $conf['listing_description_size']);

// Create a mysql query
$sql = 'UPDATE '. PROPERTIES_TABLE . ' SET description = "' . $form['description'] . '" WHERE id = "' . intval($_GET['id']) . '"';

$db->query($sql) or error ('Critical Error', mysql_error ());

1 Answer 1

1

There are many issues here, the least of which is not VERY clear SQL injection issues. But I assume you have a <textarea> tag somewhere and you are submitting that instead of the CKE content. See How to ajax-submit a form textarea input from CKEditor?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.