Write to text file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sebcash
Forum Newbie
Posts: 1
Joined: Mon Apr 23, 2007 6:31 am

Write to text file

Post by sebcash »

Hi,

I'm using fckeditor to edit a section of text. Once the form is submitted I append the data to a sql table and create a text file for Flash to import. My problem is that the text file has 'enter' break and 'tabs', I don't what that but rather a straight line of html code.

Current text file:
hotel <br />
<ul>
<li>grand</li>
<li>luxury</li>
<li>spot</li>
</ul>

Required text file:
hotel <br /><ul><li>grand</li><li>luxury</li><li>spot</li></ul>

Thanks
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

New lines should be "\n" so you could use str_replace to remove them.
Note: use double quotes not single quotes -

Code: Select all

$string_var=str_replace("\n","",$string_var);
Post Reply