<HTML> <HEAD> <TITLE>Request for more information</TITLE> <BODY>
<CENTER>Would you like more information about our company? <P>
<TABLE WIDTH = 400><TR><TD align = right>
<FORM ACTION="email.php3" METHOD="POST">
Your name:<BR> <INPUT TYPE="text" NAME="name" SIZE="20" MAXLENGTH="30"> <P> Your email address:<BR> <INPUT TYPE="text" NAME="email" SIZE="20" MAXLENGTH="30"> <P> I prefer: <SELECT NAME="preference"> <OPTION value = Apples>Apples <OPTION value = Oranges>Oranges </SELECT> <P> <INPUT TYPE="submit" VALUE="Send it!"> </FORM> </TD></TR></TABLE></CENTER>
</BODY> </HTML>
--------------------------------------
把这个文件存为moreinfo.html
注意 action指向文件:email.php3 下面就是email.php3文件:
--------------------------------------
<? /* this script will handle the variables passed from the moreinfo.html file */ PRINT "<CENTER>";PRINT "Hello, $name.";PRINT "<BR><BR>"; PRINT "Thank you for your interest.<BR><BR>"; PRINT "We will send information to $email, and have noted that you like $preference."; PRINT "</CENTER>"; ?>
<? mail("$email", "Your request for information", "$namen Thank you for your interest!nWe sell fresh corn daily over the Internet! Place your order at http://www.buycorn.com, and receive a free package of $preference!"); mail("administration@buycorn.com", "Visitor request for info.","$name requested for information.n The email address is $email. n The visitor prefers $preference."); ?>