submitting forms to file using php and a .txt file

mmsbomber

New Member
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:\[code\]<form name="input" action="form.php" method="post">Zip: <input type="text" name="zip"><input type="submit" value="http://stackoverflow.com/questions/13812906/Submit"></form>\[/code\]and here is my php:\[code\]<?php$myFile = "data.txt";$fh = fopen($myFile, 'a');$zip = $_POST["zip"];$comma_delmited_list = explode(",", $zip) . "\n";fwrite($fh, $comma_delmited_list);fclose($fh);?>\[/code\]where form.php, data.txt, and the .html file are in the same directory, any help is appreciated. Thanks.
 
Back
Top