<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("[email protected]", "visitor request for info.","$name requested for information.n the email address is $email. n the visitor prefers $preference."); ?>