How do you get content from Tinymce when submitting a form?

This is what my form looks like:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>צור כתבה</title> <script type="text/javascript" src="tiny_mce/jquery.js"></script> <script type="text/javascript" src="tiny_mce/tiny_mce.js"></script> <script type="text/javascript"> tinyMCE.init({ mode : "textareas", theme : "advanced", theme_advanced_toolbar_location : "top", height:"1000px", width:"800px", editor_selector :"mceEditor" }); tinyMCE.activeEditor.getContent(); </script> </head> <body> <div align="center" id="htmlEditor"> <form > <table> <tr> <td> <textarea name="textareas" cols="40" rows="20" class="mceEditor"></textarea> </td> </tr> <tr> <td align="center"> <input type="submit" value="צור מאמר"/> </td> </tr> </table> </form> </div> </body> </html> 

When the form is submitted, I want to receive the data inside the text field, as is, and put it in the database.

The question is how to do this, given that I am using php and $ _POST ..

I know that this function is: tinyMCE.activeEditor.getContent ();

But this is a javascript function. How to get data from this javascript function and put it in my PHP code so that I can use it to be placed in my database?!?!?

+4
source share
3 answers

In your case, you should get it using $_POST['textareas'] , because "textareas" is the name text field.

The tinyMCE.activeEditor.getContent() function is client-side, so you can get the content while you are on the page (before sending).

In any case, as Amila said, you should add method="post" to your form.

+3
source

add form method as message

 <form method="post" action="" > 

now you can get the value of textarea with $ _POST ['textareas'];

+3
source

yes, using the post method, you get the value of your input element, and for tinyMice, the name of the element for which you created instance tinyMice , in your case it is textares

+1
source

All Articles