PHP help with forms ans write to file?

Elliot

New member
I have index.html which has a form on it with a name field and a submit button. The form action is contact.php here is contact.php code.

<?php

$file = "userdatauser.txt"
$nameField = $_POST['name'];

$fileopen = fopen($file, 'a'); or die("cant open file");
if ($fileopen) {
fwrite($fileopen, $nameField);
fclose ($fileopen);


?>

I am getting an error with the namefield line why the form method is post and 'name' is the text field where they write in.
 
Back
Top