Jump to content

Recommended Posts

I have a form where I can input html coding that will be saved to a txt file and then pulled by the website to displate the code entered. I have the form going to a page with the following code.

 

<code>

<?php

$wfto=$_POST['wfto'];

 

$file_name = "data/wfto-d2.txt";

$fp = fopen($file_name, "w");

//write to the file

fwrite ($fp, "$wfto\n");

fclose($fp);

?>

</code>

 

My only issue is when it saves the coding all the " end up with \" then when the file is opened up the form text area loads this info and when resaved it will end up like \\\" this obviusly wont work well. So my question is how do I get the post data to write to the text file exactly as entered and not modified so when loaded it looks exactly as it was inputed?

Link to comment
https://forums.phpfreaks.com/topic/116759-solved-fwrite-question/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.