createtablefromformok.php
<html>
<head><title>PHP
and MySQL</title></head>
<body>
<h1>Test
of PHP</h1>
<?php
include "passformail.inc";
print ("Connected
successfully");
mysql_select_db("fortesting");
$sql
= "CREATE TABLE infofromform (formid int(5) primary key, formname
varchar(25), formemail varchar(50), formcomments text)";
$result=
mysql_query($sql,$link) or die(mysql_error());
echo
$result;
?>
</body>
</html>
gatherinfofromformok.html
<html>
<head><title>Gather
information</title></head>
<body>
<h1>Please
fill out this form to give us your feedback!</h1>
<form
method="post" action="mailinfofromformok.php">
Name: <input name = "yourname"
type = "text" /><br /><br />
Email: <input name="email"
type="text" /><br /><br />
Comments:<br />
<textarea name="comments" rows="12"
cols="40"></textarea><br />
<input type="submit"
value="Submit" />
<input type="reset"
value="Clear" />
</form>
</body>
</html>
mailinfofromformok.php
<?php
include "passformail.inc";
mysql_select_db("fortesting");
$yourname = $_REQUEST['yourname'];
$email = $_REQUEST['email'];
$comments = $_REQUEST['comments'];
$sqlgetct
= mysql_query("SELECT * from infofromform");
$numrows
= mysql_num_rows($sqlgetct);
$yourid
= $numrows + 1;
$sql
= "INSERT INTO infofromform values ('$yourid', '$yourname', '$email',
'$comments')";
$result=
mysql_query($sql,$link) or die(mysql_error());
mail(
"pgrocer@comcast.net", "Comments From Form", $comments,
"From: $email" );
header(
"Location: http://cisweb.bristol.mass.edu/~pgrocer/mail/formdb/thankyoufromform.html"
);
?>
thankyoufromform.html
<html>
<head><title>Thank
you!</title></head>
<body>
<h1>Thank
you for your comments!</h1>
</body>
</html>