htmlArea

A directory of browser-based WYSIWYG editors

  MAIN
INDEX
SEARCH
POSTS
WHO'S
ONLINE
LOG
IN

Home: WYSIWYG Forums: WYSIWYG Editor Discussion:
Not able to save in PHP


 


bgmahesh
New User

May 16, 2006, 11:42 PM

Post #1 of 3 (33911 views)
Shortcut
Not able to save in PHP Can't Post

 
I am trying to use htmlArea with PHP programs [form]. I copied the text from MS Word [which had all sorts of formatting] and pasted into htmlArea. On saving and retrieving it looks completely different. I see the code like "if xxxx elsexxx"

Is there something special I need to do to make it work with PHP/MySQL?

Mahesh


dsschimp
New User

May 17, 2006, 7:20 AM

Post #2 of 3 (33898 views)
Shortcut
Re: [bgmahesh] Not able to save in PHP [In reply to] Can't Post

I'm having the same problem with php running on windows with an access database. When I first create a new record it works great. But if I come back to edit the HTML text, it keeps pulling the old information that was originally there. Here is a sample of how I fill the textarea with html stored in the database:

<TEXTAREA CLASS="textarea" tabindex="5" id="writebody" NAME="writebody" ROWS="27" COLS="65" style="width: 100%" WRAP="VIRTUAL"><?php echo $strContent; ?></TEXTAREA>

This is my text area being filled with what I get from the database. I stored the html info in my variable "$strContent" and display like above. Is this the correct way of filling the textarea box with my html that I retrieve from the database? Or should I be using an HTMLArea method or function? I appreciate any help I can get.

Thank you!


dsschimp
New User

May 17, 2006, 10:15 PM

Post #3 of 3 (33889 views)
Shortcut
Re: [dsschimp] Not able to save in PHP [In reply to] Can't Post

Ok I finnally got it to work this time. Here is what you need to do to get this problem fixed:

Add the following line to a function that will be called when the <form> onsubmit event is triggered:

editor._textArea.value = editor.getHTML();

Make sure that you use what ever editor object you created. Mine is called "editor" like above, yours could be different. So now you can do something like this:

<html>
<script language="JavaScript">
<!--
function OkToSubmit()
{
editor._textArea.value = editor.getHTML();
return true;
}
//-->
</script>
<body>
<form action="my_script.php" method="POST" onsubmit="return OkToSubmit()">
<textarea id="writebody" name="writebody" rows="20" cols="60"></textarea>
<input type="submit" value="Submit">
</form>
</body>
</html>

By calling "editor._textArea.value = editor.getHTML();" you are insuring that what ever html/text data is added to the editor is copied in the textarea box right before you submit the page. I hope this helps people out. I'll check back to hear if it's working for others as well.

Thank you,

Mike

(This post was edited by dsschimp on May 17, 2006, 10:22 PM)

 
 
 


Search for (options)