good day, I am having a hard time figuring out how to pass the data of the tinymce text editor (plugin of textarea) to a page. I've tried AJAX and has issues. Is there any way to get this html value and pass it to a page?
Asked
Active
Viewed 796 times
0
-
TinyMCE shouldn't **need** to have the data extracted. It's only typically used inside of a CMS, which should pass the input through to a variable you can reference. What CMS are you using? If you're trying to extract from the TinyMCE **itself**, that's still absolutely possible. However, you'll need to update your question so that is shows all **relevant code** in a [**minimal, complete, and verifiable example**](http://stackoverflow.com/help/mcve). Otherwise, how can we possibly know which element to target? – Obsidian Age Jul 17 '17 at 03:05
-
hi, i am asking for a method or a way which other gives their own structure of how they used the tinymce, i am not asking for a solution to the code. However, if you want a minimal, complete, and verifiable example. Then I asked a question earlier https://stackoverflow.com/questions/45128663/sending-value-to-a-page-using-ajax-form-action-does-not-work/45129230?noredirect=1#comment77228079_45129230 – Jarvis Millan Jul 17 '17 at 03:15
-
So you're essentially asking how you can integrate a TinyMCE editor into a CMS you're making? That's incredibly vague, and would likely come down to personal preference. – Obsidian Age Jul 17 '17 at 03:18
-
Yes I am hoping someone can demonstrate or show how it is done and It is not vague, I am asking clearly that: 'is there a way; You just don't agree to the question. – Jarvis Millan Jul 17 '17 at 03:21
-
**How** you integrate is entirely down to personal preference. And you haven't shown evidence of trying anything. I'm not sure if this question is opinion-based, too broad, requesting an external guide, or unclear. Regardless, it's considered '[**off-topic**](http://stackoverflow.com/help/dont-ask)' for StackOverflow. Please refer to the documentation for topics that are considered '[**on-topic**](http://stackoverflow.com/help/on-topic)', review [**how to ask good questions**](http://stackoverflow.com/help/how-to-ask), and take the [**tour**](http://stackoverflow.com/tour) of the site :) – Obsidian Age Jul 17 '17 at 03:25
-
What do you mean "pass the data of the tinymce text editor to a page"? Do you mean _render_? – embarq Jul 17 '17 at 03:27
-
@embarq kind of. and I also want to store it in a variable. – Jarvis Millan Jul 17 '17 at 03:29
-
@JarvisMillan try this one: http://jsbin.com/yihoco/edit?html,js,console,output – embarq Jul 17 '17 at 03:38
1 Answers
0
The TinyMCE plugin uses a HTML textarea element. Data from the editor can be posted through a form and extracted through PHP like a normal textarea.
Sample code:
HTML:
<form action="sample.php" method="post">
<textarea id="editor" name="editor"></textarea>
<button type="submit" name="submit">Submit</button>
</form>
PHP:
if(isset($_POST['submit'])) {
$content = $_POST['editor'];
//Text from editor stored in $content
}
From here, you can use PHP to echo the contents of $content
onto the page.

Locke Donohoe
- 482
- 1
- 7
- 22
-
-
the problem with this is, when you insert video or media in to the text area. then send it, the server itself blocks it. and displays error – Jarvis Millan Jul 17 '17 at 04:39
-
@JarvisMillan this method does get the HTML of it, and I haven't tried video or other media but images work using this method. – Locke Donohoe Jul 17 '17 at 05:28
-
@JarvisMillan your question asked how to get the HTML value and pass it to the page, this method works for that purpose. If you have more specific requirements you need to state them in your question. – Locke Donohoe Jul 17 '17 at 05:29