创建一个页面,人们可以在其中添加想法(HTML / PHP)[关闭]

basically I want to add a system to my site where people are able to submit ideas via a form. Now I originally did it like this:

<form name="web_form" id="web_form" method="post" action="process-form-data.php">
        <p><label>Name: </label><input type="text" name="name" id="name" /></p>
        <p><label>Idea: </label><input type="text" name="idea" id="idea" maxlength="3000" height="400px" width="550px" /></p>
        <p><input type="submit" name="s1″ id="s1″ value="Submit" /></p>
</form>

Process form data then sends the info to a text file:

<?php
$name = $_POST['name'];
$idea = $_POST['idea'];
$fp = fopen("ideas.txt", "a");
$savestring = $name . "," . $idea . "n";
fwrite($fp, $savestring);
fclose($fp);
echo "<h1>You data has been saved in a text file!</h1>";
?>

However when including the .txt file on the original page, it comes out in a one line format like this:

Name,Idea Sam,this is my ideanSam,this is my ideanSam,this is my idean

What is a better way of implementing this system for non web-savvy users?

All I want is a simple page where all ideas can be seen by everyone logged in.

Many thanks.

$savestring = $name . "," . $idea . "
";

You missed a

Using a decent IDE with good configurations could highlight special chars with escapes. That help to find out such simple errors.

If you want to display the content of the text file in the browser, it needs to be HTML compliant. So, you need <BR> for each newline:

$savestring = $name . "," . $idea . "<br>";