admin管理员组

文章数量:1293566

This is how my form looks like:

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

This is how my form looks like:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3/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 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?!?!?

Share Improve this question edited Jul 5, 2016 at 5:16 moped 2,2472 gold badges26 silver badges31 bronze badges asked Oct 12, 2011 at 10:50 Dmitry MakovetskiydDmitry Makovetskiyd 7,05333 gold badges102 silver badges160 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 3

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.

add form method as post

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

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

yes by using post method you will get the value of your input element and for the tinyMice the name of the element to which you have created the instance of the tinyMice in your case it's textares

本文标签: javascriptHow do you get the content from Tinymce when the form is postedStack Overflow