I'm using this code to add user input to a text file:
<?php
//establish variables
$myFile = "chapter2.txt";
$fh = fopen($myFile, 'a') or die("can't open file");
$name = $_POST["name"];
$gnumber = $_POST["gnumber"];
fwrite($fh, $name);
fwrite($fh, "
");
fwrite($fh, $gnumber);
fclose($fh);
?>
However, it adds it to the text file like this:
namegnumber
Instead of this:
name
gnumber
Why does this happen?