I'm trying to make it so that every time the person presses the submit button, a txt file will be created containing the information on the textboxes. After the form is submitted, it redirects to a different html file. But this does not work
THIS IS MY PHP CODE (File name:process.php)
<?php
$form = fopen("forms/openhouse_signup.txt", "w") or die("Error: Missing Forms on Server!");
if (!empty($_POST)){
$txt = "Parent's Name: ".$_POST['parentN']."\n";
fwrite($form, $txt);
$txt = "Email Address: ".$_POST['email']."\n";
fwrite($form, $txt);
$txt = "Postal Code: ".$_POST['postal']."\n";
fwrite($form, $txt);
$txt = "Phone Number: ".$_POST['phone']."\n";
fwrite($form, $txt);
$txt = "Child's Name: ".$_POST['childN']."\n";
fwrite($form, $txt);
$txt = "Child's Age: ".$_POST['childA']."\n";
fwrite($form, $txt);
$txt = "\n ----------------------------- \n";
fwrite($form, $txt);
fclose($form);
header('Location: done.html');
}
?>
MY HTML CODE (File Name:signup.html)
<h2 style="font-family:Arial, Sans-serif">Please Fill In The Following Boxes To Sign Up</h2>
<form style="font-family:Arial, sans-serif; font-size:12pt" name="input" action="process.php" method="POST">
Full Name of Parent:<br>
<input class="txtbox" type="text" name="parentN"><br><br>
Email Address:<br>
<input class="txtbox" type="text" name="email"><br><br>
Postal Code:<br>
<input class="txtbox" type="text" name="postal"><br><br>
Phone Number:<br>
<input class="txtbox" type="text" name="phone"><br><br>
Full Name of Child:<br>
<input class="txtbox" type="text" name="childN"><br><br>
Age of Child:<br>
<input class="txtbox" type="text" name="childA"><br><br>
<input type="submit" value="Sign Up!">
</form>
if(!empty($_POST)). What if the user creates Elements using firebug, or something? Just a comment.