1,收集Email地址 //index.htm
<html> <body> <form action="index.php" method="post"> 姓 名:<br> <input type="text" name="name" size="20" maxlength="20" value=""><br> Email:<br> <input type="text" name="email" size="20" maxlength="40" value=""><br> <input type="submit" value="确认提交"> </form> </body> </html> //index.php <html> <head> <title>收集Email地址</title> </head> <body> <? print "您好, $name!. 您提交的Email地址为:$email"; ?> </body> </html>
2,反馈表单
<html> <head> <title>反馈表单</title> </head> <body> <form action="feedback.php" method="post"> 用户名:<input type="text" name="username" size="30"> <br><br> Email地址:<input type="text" name="useraddr" size="30"> <br><br> <textarea name="comments" cols="30" rows="5"> </textarea><br> <input type="submit" value="提 交"> </form> </body> </html>
3,接收反馈内容的程序: feedback.php
<?php $username = $_POST['username']; $useraddr = $_POST['useraddr']; $comments = $_POST['comments']; $to = "php@jb200.com"; $re = "来自网站的用户反馈"; $msg = $comments; $headers = "MIME-Version: 1.0rn"; $headers .= "Content-type: text/html; charset=iso-8859-1rn"; $headers .= "From: $useraddr rn"; $headers .= "Cc: another@hotmail.com rn"; mail( $to, $re, $msg, $headers ); ?> <html> <head> <title>收集反馈内容</title> </head> <body> <h3>感谢您的参与:</h3> 反馈内容来自:<?php echo($username); ?><br> 回复给:<?php echo($useraddr); ?> </body> </html>