next up previous contents index
Next: A PHP-script that generates Up: Examples Previous: A simple HTML-Form (HTML)   Contents   Index


A simple PHP-script that evaluates the above form (PHP)

When the user pushes the ``Ready''-button in the above HTML-Page a script dante.php3 is called. In our example we assume that the script is written in PHP (see section 1.2.2). A documentation for PHP can be found on their homepage.

One important variable that will be defined is $POEM that contains the user's input. The following script shows how this input can be stored in a plain text file.

<html>
<head>
</head>
<body>
Thank you for contributing<P>
<?
   $fd = fopen ("verse.txt","a");
   fwrite($fd,"$POEM\n");       
   fclose ($fd);
?>
</body>
</html>

The PHP-function fopen opens a file, fwrite writes into the file, and fclose closes the file again.


next up previous contents index
Next: A PHP-script that generates Up: Examples Previous: A simple HTML-Form (HTML)   Contents   Index
Oliver Kirchkamp