Dmitry Makovetskiyd Dmitry Makovetskiyd - 6 months ago 34
PHP Question

How do you get the content from Tinymce when the form is posted?

This is how my form looks like:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<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">

mode : "textareas",
theme : "advanced",
theme_advanced_toolbar_location : "top",

editor_selector :"mceEditor"




<div align="center" id="htmlEditor">
<form >
<textarea name="textareas" cols="40" rows="20" class="mceEditor"></textarea>
<td align="center">
<input type="submit" value="צור מאמר"/>


When the form is posted, I want to fetch the data that is inside the textarea as it is and put it into the database.

The question is how do I do it, considering that I use php and $_POST..

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

But it is a javascript function. How do I fetch the data from that javascript function and put into my php code so that I will be able to use it to put into my database?!?!?


In your case you have to get it using $_POST['textareas'] because 'textareas' is the name of the textarea.

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

Anyway as Amila said, you should add the method="post" to your form.