I am trying to write user input to a file. I know this is common and have searched these boards but cant find the error in my script.
The script below is all one file called formopen.php. I am trying to collect input using a form then insert those values into a text file when the form is submitted by submitting to itself.
I know there is no problem with permissions since without the form, and when the variables are defined in the php, there is no problem with writing to the file.
I'm not getting any errors, just not writing the data to the file.
Thanks in advance.
<html>
<body>
<form name="formopen" action="formopen.php">
<p>Name:<br>
<input name="name" type="text" size="10">
<br>
Words:<br>
<input name="words" type="text" size="10">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
</body>
</html>
<?
$content = "\n$name \n $words";
$fp = fopen("blank.txt", "a");
//put my content into the file
fputs ($fp, $content);
//close file
fclose($fp);
?>