html代码:

<html>
 
 <head>
  < >用户反馈表单提交 http://www.manongjc.com/article/1217.html</ >
 </head>
 
 <body>
 
 <form action=\"feedback.php\" method=\"post\">
 Name:<input type=\"text\" name=\"username\" size=\"30\">
 <br><br>
 Email:<input type=\"text\" name=\"email\" size=\"30\">
 <br><br>
 <textarea name=\"descrption\" cols=\"30\" rows=\"5\">
 </textarea><br>
 <input type=\"submit\" value=\"提交表单\">
 </form>
 
 </body>
 
</html>

该页面表单包含两个input文本域,分别用来填写用户名和用户地址,还有一个textarea文本域,用来填写反馈的信息详情,然后一个submit提交按钮,用来提交表单到服务器。

 

php代码

用户提交表单后,服务器接收表单信息,然后处理表单信息并把数据保存到数据库。

<?php
 
$username = $_POST[\'username\'];
$useraddr = $_POST[\'email\'];
$descrption= $_POST[\'descrption\'];
 
$to = \"php@h.com\";  
$re = \"Website Feedback\";         
$msg = $descrption;            
// http://www.manongjc.com/article/1217.html
$headers  = \"MIME-Version: 1.0\\r\\n\";  
$headers .= \"Content-type: text/html; charset=iso-8859-1\\r\\n\";
$headers .= \"From: $useraddr \\r\\n\";    
$headers .= \"Cc: another@hotmail.com \\r\\n\";
 
mail( $to, $re, $msg, $headers );      
 
?>
收藏 打印