Jump to content

Recommended Posts

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.

 

Link to comment
https://forums.phpfreaks.com/topic/52501-php-write-to-html-file-and-create-breaks/
Share on other sites

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.

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.