I know this is a relatively basic question, but I cannot seem to find a complete answer anywhere. How may I submit an HTML form to a flat .txt file without changing the content of the browser, besides a reload. Here is the content of my form inside my HTML file:
<form name="input" action="form.php" method="post">
Zip: <input type="text" name="zip">
<input type="submit" value="Submit">
</form>
and here is my php:
<?php
$myFile = "data.txt";
$fh = fopen($myFile, 'a');
$zip = $_POST["zip"];
$comma_delmited_list = explode(",", $zip) . "\n";
fwrite($fh, $comma_delmited_list);
fclose($fh);
?>
where form.php, data.txt, and the .html file are in the same directory, any help is appreciated. Thanks.