Hi,

I'm trying to insert incoming data from teaxarea into txt (can be without extention as well) file but the incoming data is being manipulated automatically which I don't want. I need to insert as is.

How can I solve this problem?

Thanks

My codes to insert:

$handle = fopen('cms/files' . $_POST['hidden_file_name'], 'w');
fwrite($handle, $_POST['textarea_content']);
fclose($handle);


OR


file_put_contents('cms/files/' . $_POST['hidden_file_name'], $_POST['textarea_content']);

Incoming data:

<iframe width="560" height="349" src="http://www.youtube.com/embed/1232123123456240" frameborder="0"></iframe>

When inserted into TXT file it appears like this:

<span class=\"webkit-html-tag\" style=\"font-size: medium; font-family: monospace; white-space: pre-wrap; \"><iframe <span class=\"webkit-html-attribute-name\">width</span>=\"<span class=\"webkit-html-attribute-value\">560</span>\" <span class=\"webkit-html-attribute-name\">height</span>=\"<span class=\"webkit-html-attribute-value\">349</span>\" <span class=\"webkit-html-attribute-name\">src</span>=\"<a class=\"webkit-html-attribute-value webkit-html-resource-link\" target=\"_blank\" href=\"http://www.youtube.com/embed/12312134233110\">http://www.youtube.com/embed/b34d6FSHPxU</a>\" <span class=\"webkit-html-attribute-name\">frameborder</span>=\"<span class=\"webkit-html-attribute-value\">0</span>\"></span><span class=\"webkit-html-tag\" style=\"font-size: medium; font-family: monospace; white-space: pre-wrap; \"></iframe></span><br>
Member Avatar for diafol

The trouble is you're using a wysiwyg editor not a textarea. It adds all sorts of markup and attributes. If you click on the html tab or button on your editor, you can clean out all that stuff before pressing save.
Alternatively, there may be a setting in the editor config file to prevent all the additional tags and attributes.

Which editor are you using?

This is all assuming it is an editor issue of course :)

I'm using NicEdit. It works fine with all features but when it comes to adding html codes, it fails.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.