Form.html
process.php
sla it op in dezelfde map en open form.html, typ u bericht in en klik op verstuur, dan word er een text bestand aangemaakt.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Input Form</title>
</head>
<body>
<form action="process.php" method="POST" name="inputform" id="inputform">
Uw naam:
<input type="text" size="50" name="field1" />
<BR>
<BR>
Uw e-mailadres:
<input type="text" size="50" name="field2" />
<BR>
<BR>
Uw bericht: <BR>
<textarea rows="10" cols="50" name="field3">
Typ hier uw bericht.
</textarea>
<BR>
<BR>
<input type="submit" name="submit" value="Submit" />
</form>
</body>
</html>
process.php
Code:
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$field1 = $_POST['field1'] ;
$field2 = $_POST['field2'] ;
$field3 = $_POST['field3'] ;
$f=fopen("file.txt","a");
fwrite($f,"$field1 | $field2 | $field3
\r\n");
fclose($f);
}
?>
sla it op in dezelfde map en open form.html, typ u bericht in en klik op verstuur, dan word er een text bestand aangemaakt.