I have got CKEditor working okay and can save data to and from MYSQL.
What I want to do is get the HTML created and send this in an email so the content is the same as in the CKEditor.
I can get the HTML with
var dataInEditor = CKEDITOR.instances.Textarea1.getData();
Is this possible in javascript ?
Cheers
Steve Warby
Got it working okay.
btnPage2Copy.onclick=function(){
var dataInEditor = encodeURI(CKEDITOR.instances.Textarea1.getData());
req = Ajax("http://www.xxx.com/mail.php?body=" + dataInEditor,quotesReturned);
}
function quotesReturned() {
if (req.status == 200) { //success
alert('data back from html'+ req.responseText);
}
else {//'failure
alert('error '+ req.err);
}
};
mail.php code
<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST');
$to = 'sales@surplusanywhere.com';
$from = 'sales@surplusanywhere.com';
$body = rawurldecode($_GET["body"]);
$subject = 'DEAL NO';
echo 'HTML Recived = '.$body ;
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Create email headers
$headers .= 'From: '.$from."\r\n".
'Reply-To: '.$from."\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $body, $headers);
?>
Cheers
Steve Warby
There’s always problems…
Php mail can only do so many lines.
Looking at PHPmailer
After a few hours of ‘f&*^ing around’ I realised I was using GET instead of POST and it was that that was cutting of the data.
The site is nearly there now using NSBasic & datatables with their Editor in the background to populate the deals. ( www.datatables.net )
Work in progress SurplusAnywhere
Cheers
Steve Warby