当前位置: 首页 > 图文教程 > 网络编程 > PHP > 用PHP制作的意见反馈表

PHP
PHP 开发环境的选择、建立及使用(5)
PHP 开发环境的选择、建立及使用(6)
PHP 开发环境的选择、建立及使用(7)
PHP 开发环境的选择、建立及使用(8)
PHP 开发环境的选择、建立及使用(9)
Win2003下APACHE PHP5 MYSQL4 PHPMYADMIN 的简易安装配置
PHP新手上路(八) 文件上传
PHP新手上路(九) 投票系统
PHP新手上路(十) 简易banner动态更替
PHP新手上路(十一) 数据库链接
PHP新手上路(十二)使用PHP来操作Oracle数据库
PHP新手上路(十三)PHP资源
PHP新手上路(十四) 其他杂项
session全教程(一)
session全教程(二)
session全教程(三)
PHP编码规范
第十五节--Zend引擎的发展 -- Classes and Objects in PHP5 [15]
第十四节--命名空间 -- Classes and Objects in PHP5 [14]
第十二节--类的自动加载 -- Classes and Objects in PHP5 [12]

用PHP制作的意见反馈表


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-08-14   浏览: 120 ::
收藏到网摘: n/a

这是一个用PHP制作的意见反馈表,稍加修改也可用于网上发信程序,主要是让访问者填写表单,用PHP处理后发送到管理员信箱,并向访问者信箱发送一个证实信件。

about.php
-------------------------
<html>
<head>
<title>意见反馈表</title>
</head>
<body>
<?php

$adminmail="[email protected]";#管理员信箱
$pagename="Acme";#主页名称
$pageline="http://acme.oso.com.cn";#主页地址

#管理员信件内容
if(($formno1!="")and($formno4!="")and($formno11!="")){

$Email=$formno4;#来访者E-mail
$sender=$formno1;#送信人
$nowtime=date("Y年m月d日H时i分");


$tmpfilename=tempnam("./tmp","dm");
$fp=fopen($tmpfilename,"w");

fwrite($fp,"From:".$Email."n");
fwrite($fp,"Subject:".$sender."<".$pagename."-意见反馈表>nn");
fwrite($fp,"送信人:".$sender."n发信IP:".$REMOTE_ADDR."n发信时间:".$nowtime."nn");
fwrite($fp,"反馈表详细内容:n------------------------------------------------------n");
fwrite($fp,"姓名:".$formno1."n性别:".$formno2."n年龄:".$formno3."nE-mail:".$formno4."n工作单位:".$formno5."n联系地址:".$formno6."n邮编:".$formno7."n电话:".$formno8."n传真:".$formno9."n网址:".$formno10."n意见建议:".$formno11."n------------------------------------------------------n");
fclose($fp);

$execstr="cat".$tmpfilename."|/usr/sbin/sendmail".$adminmail;
exec($execstr);

$execstr="echo$sender$nowtime$REMOTE_ADDR$REMOTE_HOST>>mail.log";
exec($execstr);

#来客信件内容;
$tmpfilename1=tempnam("./tmp","dm");
$fp=fopen($tmpfilename1,"w");

fwrite($fp,"From:".$adminmail."n");
fwrite($fp,"Subject:你在[".$pagename."]填写的<意见反馈表>nn");
fwrite($fp,"****此信为自动回复信件,请勿回复。给你带来不便,我们深表歉意。****nn------------------------------------------------------n非常感谢你在[".$pagename."]填写意见反馈表!n以下是您在".$nowtime."填写的详细内容,请确认:n------------------------------------------------------n");
fwrite($fp,"姓名:".$formno1."n性别:".$formno2."n年龄:".$formno3."nE-mail:".$formno4."n工作单位:".$formno5."n联系地址:".$formno6."n邮编:".$formno7."n电话:".$formno8."n传真:".$formno9."n网址:".$formno10."n意见建议:".$formno11."n------------------------------------------------------n".$pagename.":".$pageline."nE-mail:".$adminmail);
fclose($fp);

$execstr="cat".$tmpfilename1."|/usr/sbin/sendmail".$Email;
exec($execstr);

#确认页开始;
echo"
<styletype=text/css><STYLE>
A{FONT-SIZE:9pt}
A:link{COLOR:#006666;}
A:visited{COLOR:#006666;}
A:hover{COLOR:#ff0000;TEXT-DECORATION:underline}
TD{FONT-SIZE:9pt}
INPUT{FONT-SIZE:9pt}
</style>
<br><palign=center><fontsize=4><b>***非常感谢你在<ahref=$pageline>$pagename</a>填写意见反馈表!***</b></font></p>以下是您填写的详细内容:<hr><br>
<b>姓名:</b>$formno1<br>
<b>性别:</b>$formno2<br>
<b>年龄:</b>$formno3<br>
<b>E-mail:</b> $formno4<br>
<b>工作单位:</b>$formno5<br>
<b>联系地址:</b>$formno6<br>
<b>邮编:</b>$formno7<br>
<b>电话:</b>$formno8<br>
<b>传真:</b>$formno9<br>
<b>网址:</b>$formno10<br>
<b>意见建议:</b>$formno11<br><br>
<fontcolor=#993333>谢谢您!!!</font>
<hr><inputTYPE=buttonVALUE=返回上一页&&f1.formno2.value!=""&&f1.formno3.value!=""&&f1.formno4.value!=""&&f1.formno11.value!=""){
f1.submit();
}
else{
alert("带*为必填项,请全部填写后再次提交。nn谢谢合作!");
}
}
</script>
<palign="center"><fontsize="5"color="#009999">意见反馈表</font></p><br>
<tablewidth="90%"border="0"align="center"cellspacing="1"cellpadding="5"bgcolor="#F2F2F2">
<tr>
<td>
<formaction=<?echo($GLOBALS["PHP_SELF"]);?>method=postname=f1>
<tablewidth="100%"border="0">
<tr>
<tdwidth="32%"><fontsize="3">您的姓名:</font><fontsize="3">
<fontcolor="#CC0000"></font></font></td>
<tdwidth="68%"><fontsize="3">
<inputtype="text"name="formno1"size="8">
<fontcolor="#CC0000">*</font></font></td>
</tr>
<tr>
<tdwidth="32%"><fontsize="3">您的性别:</font></td>
<tdwidth="68%"><fontsize="3">
<selectname="formno2">
<optionvalue="男">男</option>
<optionvalue="女">女</option>
</select>
<fontcolor="#CC0000">*</font></font></td>
</tr>
<tr>
<tdwidth="32%"><fontsize="3">您的年龄:</font></td>
<tdwidth="68%"><fontsize="3">
<inputtype="text"name="formno3"size="3"maxlength="3">
<fontcolor="#CC0000">*</font></font></td>
</tr>
<tr>
<tdwidth="32%"><fontsize="3">您的E-mail:</font></td>
<tdwidth="68%"><fontsize="3">
<inputtype="text"name="formno4"maxlength="40">
<fontcolor="#CC0000">*</font></font></td>
</tr>
<tr>
<tdwidth="32%"><fontsize="3">您的工作单位:</font></td>
<tdwidth="68%"><fontsize="3">
<inputtype="text"name="formno5"maxlength="100">
</font></td>
</tr>
<tr>
<tdwidth="32%"><fontsize="3">您的联系地址:</font></td>
<tdwidth="68%"><fontsize="3">
<inputtype="text"name="formno6"maxlength="100">
</font></td>
</tr>
<tr>
<tdwidth="32%"><fontsize="3">您的邮政编码:</font></td>
<tdwidth="68%">
<inputtype="text"name="formno7"maxlength="10">
</td>
</tr>
<tr>
<tdwidth="32%"><fontsize="3">您的电话:</font></td>
<tdwidth="68%">
<inputtype="text"name="formno8"maxlength="20">
</td>
</tr>
<tr>
<tdwidth="32%"><fontsize="3">您的传真:</font></td>
<tdwidth="68%">
<inputtype="text"name="formno9"maxlength="20">
</td>
</tr>
<tr>
<tdwidth="32%"><fontsize="3">您的网址:</font></td>
<tdwidth="68%">
<inputtype="text"name="formno10"maxlength="100">
</td>
</tr>
<tr>
<tdwidth="32%"valign="top"><fontsize="3">意见或要求:</font></td>
<tdwidth="68%">
<textareaname="formno11"cols="30"rows="5"></textarea>
<fontcolor="#CC0000">*</font></td>
</tr>
<tr>
<tdwidth="32%"></td>
<tdwidth="68%">
<inputtype=buttonvalue="发送"name="button">


<inputtype="reset"name="clear"value="清除">
</td>
</tr>
<tr>
<tdcolspan="2">
<p><br>
注:标<fontcolor="#CC0000">*</font>项目为必填项。</p>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<?
}
?>
</body>
</html>