Nightmare61 Posted May 22, 2007 Share Posted May 22, 2007 Okay, so I have... Write .php <? if(isset($_POST['write_file'])) { $name = $_POST['name']; $suggestion = $_POST['suggestion']; $fp = fopen("ideas.html", "a"); fputs($fp, "$name\t$suggestion\n"); fclose($fp); echo 'Thank you, Your suggestion has been submitted'; } else { die; } ?> index.php <title> W.I.P Ideas </title> <center> <form method="POST" action="write.php"> <input type="hidden" name="write_file" value="true"> IRC Nick: <input type="text" name="name" size="25"> <br> <textarea name="suggestion" rows=25 cols=40> </textarea> <br> <input type="Submit" name="B1" value="Click To Submit"> Okay, I've got this, Now how to I made it so that when it writes to ideas.html it'll write it with <br's> so that I can use <?php include('/home/benny/public_html/wip/ideas.txt'); ?> On the index file so that it'll print it out as ideas.txt or ideas.html is... Any help will be a treat, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/52501-php-write-to-html-file-and-create-breaks/ Share on other sites More sharing options...
colombian Posted May 22, 2007 Share Posted May 22, 2007 Depends on what you're doing. If you're simply going to write it to HTML, you can embbed the <br> tags within your php code. echo "<br>bla bla <br>" If your goal is to replace the \n with <br> then you can run a string replace command to accomplish that. Quote Link to comment https://forums.phpfreaks.com/topic/52501-php-write-to-html-file-and-create-breaks/#findComment-259068 Share on other sites More sharing options...
per1os Posted May 22, 2007 Share Posted May 22, 2007 To convert \n to <br>'s look into www.php.net/nl2br a bit easier than str_Replace as it is already done for you. Also if you are writing it to a file, why not just instead of using \n use < br />\n ?? or just < br /> ??? Quote Link to comment https://forums.phpfreaks.com/topic/52501-php-write-to-html-file-and-create-breaks/#findComment-259090 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.