Hello,
I am trying to have a user enter some data in a form and then save that data to a text file localy on the server. But the code I have does not work. It says that the variables for the text fields I have defined do not exist. I turned the global variables on and it still says the same thing. Please help! Thank you.
I am trying to have a user enter some data in a form and then save that data to a text file localy on the server. But the code I have does not work. It says that the variables for the text fields I have defined do not exist. I turned the global variables on and it still says the same thing. Please help! Thank you.
Code:
<?php
// Open the file and erase the contents if any
$fp = fopen('C:test.txt', 'a');
// Write the data to the file
fwrite($fp, $_POST['$FirstName']);
//fwrite($fp, $_POST['$LastName']);
fwrite($fp, "------------------------------");
// Close the file
fclose($fp);
?>
<p>To sign up for the Excel workshop please fill out the form below:
</p>
<form action=="<?=$_SERVER['PHP_SELF']?>" method="post">
Type your first name:
<input type="text" name="FirstName" size="20">
<br>Type your last name:
<input type="text" name="LastName" size="20">
<br>
<input type="submit" value="submit" name="submit">
<a href="Education/EductionMain.htm"></a>
</form>