You need to get the content of the iframe using
JS. I recommend getting the innerHTML of the <body> element of the <iframe>, and placing that value in a hidden form field in the parent document.
Though there are some things to keep in mind.
1. You can't just place HTML in a hidden field, you'll first have to convert the HTML and special characters into entities, e.g. a double quote becomes ", a left angle bracket becomes <, an amphersand becomes &, etc. Then once passed to PHP you have to decode the HTML entities back into the original characters. This might not be a problem if you are populating the hidden field's value via Javascript and not hard-coding it through PHP, but it's something to keep in mind.
Again, I suggest just using HTMLArea, there are lots of things to consider when writing your own WYSIWYG, HTMLArea handles these things for you. It replaces textarea fields in forms, so whatever name you give a textarea that is replaced with HTMLArea is the name of the variable passed to PHP through POST when the form is submitted.
You might access the iframe DOM like this...
function getWYSIWYG()
{
// set the name and id attributes of the <iframe> element, fill in that value here.
var iframe = document.frames[0]; //
offset of frame here
// set the id attribute of the <body> element in the inline frame
// reference that id here to get the HTML inside of the iframe.
var wysiwyg_value = iframe.getElementById('
body id name').innerHTML;
// Place the value in a hidden field of the current form.
document.getElementById('
hidden field id').value = wysiwyg_value;
// Submit the form.
document.getElementById('
form id').submit();
}
Then add an onclick handler for the submit button of the form.
HTH!
Regards,
Rich
--
[
http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design