Q. How do you store data contributed to a site via a form?
A. Using a dynamic server side script (this can be PHP, CGI/Perl, ASP/Basic/C++, Java/JSP, and more).

Here's an example in PHP.   First, the form (put this in somefile.html):

<form action="ourFirstScript.php">
Name: <input name="n" value=""> <br>
<input type="submit" value="Send string to server"> </form>


<?php // The name of this document is ourFirstScript.php

if(!file_exists("nameList.txt")){
     print("oops! webmaster you need to create that file first");
     exit();
}

if(!is_writeable("nameList.txt")){
     print("webmaster you need to add write permissions to file");
     exit();
}

$f = fopen("nameList.txt", "a"); // a is for append or "add to end of"
if($f){
     fwrite($f, $n); // $n is from our form!
     fclose($f);
}else{
     print("For some reason we couldn't open that file");
     exit();
}

print("get ready to see the contents of the file<hr><pre>");
readfile("nameList.txt"); // just spits out the contents of the file
?>

Commentary   What we've done is not very good practice because the page we produced is very poorly formed HTML. Secondly, we didn't check to see how big the data in $n was, or if there was any at all. Sloppiness like that can get you in trouble with the script kiddies who want to screw up your website.
      Lastly, the data format for our file is very unstructured. We could improve this by adding an end line character after each new name. This would be the equivalent of hitting the return key after each name in a text document. Since there is no agreed-upon symbol for return key, programming languages use \n as the two-character symbol for endline. So we would amend our script to say fwrite($f, "$n \n");