Comments and feedback form made in PHP

Source: Internet
Author: User
Tags comments mail zip
This is a use of PHP production feedback form, a little modification can also be used for online mail, mainly to allow visitors to fill out the form, with PHP processing to send to the administrator mailbox, and send a confirmation letter to the visitor mailbox.

about.php
-------------------------
<title> Feedback Form </title>
<body>
<?php

$adminmail = "admin@acme.oso.com.cn"; #管理员信箱
$pagename = "ACME"; #主页名称
$pageline = "http://acme.oso.com.cn"; #主页地址

#管理员信件内容
if ($formno 1!= "") and ($formno 4!= "") and ($formno 11!= "")) {

$Email = $formno 4; #来访者E-mail
$sender = $formno 1; #送信人
$nowtime =date ("Y year M month D Day h time I minute");


$tmpfilename = Tempnam ("./tmp", "DM");
$fp = fopen ($tmpfilename, "w");

Fwrite ($FP, "from:". $Email. " n ");
Fwrite ($FP, "Subject:". $sender. "<" $pagename. " -Feedback Form >nn ");
Fwrite ($fp, "Messenger:" $sender. " n Send IP: ". $REMOTE _addr." N Sending time: ". $nowtime." nn ");
Fwrite ($fp, "Feedback table details: n------------------------------------------------------n");
Fwrite ($fp, "Name:". $formno 1. " N Sex: ". $formno 2." N Age: ". $formno 3." Ne-mail: ". $formno 4." N Work unit: ". $formno 5." N Contact Address: ". $formno 6." N Zip Code: ". $formno 7." N Telephone: ". $formno 8." N Fax: ". $formno 9." N URL: ". $formno 10." N comments suggested: ". $formno 11." 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);

#来客信件内容;
$tmpfilename 1 = Tempnam ("./tmp", "DM");
$fp = fopen ($tmpfilename 1, "w");

Fwrite ($FP, "from:". $adminmail. " n ");
Fwrite ($FP, "Subject: You are in [". $pagename. "] Fill in the < feedback form >nn ");
Fwrite ($FP, "* * * * This letter for automatic reply letter, please do not reply. We apologize for the inconvenience caused to you. NN------------------------------------------------------n Thank you very much for [". $pagename."] Fill out Feedback Form! n Below you are in ". $nowtime." Fill in the details, please confirm: N------------------------------------------------------n ");
Fwrite ($fp, "Name:". $formno 1. " N Sex: ". $formno 2." N Age: ". $formno 3." Ne-mail: ". $formno 4." N Work unit: ". $formno 5." N Contact Address: ". $formno 6." N Zip Code: ". $formno 7." N Telephone: ". $formno 8." N Fax: ". $formno 9." N URL: ". $formno 10." N comments suggested: ". $formno 11." n------------------------------------------------------n ". $pagename." : ". $pageline." Ne-mail: ". $adminmail);
Fclose ($FP);

$execstr = "Cat". $tmpfilename 1. "| /usr/sbin/sendmail ". $Email;
EXEC ($EXECSTR);

#确认页开始;
echo "
<style type=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><p Align=center><font size=4><b>*** Thank you very much for <a href= $pageline > $pagename </a> Fill out Feedback Form! </b></font></p> Below are the details you fill out:<b> name:</b> $formno 1<br>
<b> Sex:</b> $formno 2<br>
<b> Age:</b> $formno 3<br>
<b>E-mail:</b> $formno 4<br>
<b> work Unit:</b> $formno 5<br>
<b> Contact Address:</b> $formno 6<br>
<b> Postcode:</b> $formno 7<br>
<b> Telephone:</b> $formno 8<br>
<b> Fax:</b> $formno 9<br>
<b> website:</b> $formno 10<br>
<b> Advice:</b> $formno 11<br><br>
<font color= #993333 > Thank you!!! </font>
<p align=center><font size=3> $pagename </font>:<a href= $pageline > $pageline </a></p ></font><p>
";
#确认页结束;

} else {
?>
<script language=javascript>
function Save () {
if (f1.formno1.value!= "" && f1.formno2.value!= "" && f1.formno3.value!= "" && f1.formno4.value! = "" && f1.formno11.value!= "") {
F1.submit ();
}
else{
Alert ("with * is required, please complete and submit again.") nn thank you for your cooperation! ");
}
}
</script>
<p align= "center" ><font size= "5" color= "#009999" > Feedback Form </font></p><br>
<table width= "90%" border= "0" align= "center" cellspacing= "1" cellpadding= "5" bgcolor= "#F2F2F2" >
<tr>
<td>
<form action=<? Echo ($GLOBALS ["php_self"]);?> method=post name=f1>
<table width= "100%" border= "0" >
<tr>
&LT;TD width= "32%" > <font size= "3" > Your name:</font> <font size= "3" >
<font color= "#CC0000" > </font></font></td>
&LT;TD width= "68%" > <font size= "3" >
<input type= "text" name= "Formno1" size= "8" >
<font color= "#CC0000" > *</font></font></td>
</tr>
<tr>
&LT;TD width= "32%" > <font size= "3" > Your gender:</font></td>
&LT;TD width= "68%" ><font size= "3" >
<select name= "Formno2" >
<option value= "Men" > Men </option>
<option value= "female" > Female </option>
</select>
<font color= "#CC0000" > *</font></font></td>
</tr>
<tr>
&LT;TD width= "32%" ><font size= "3" > Your age:</font> </td>
&LT;TD width= "68%" ><font size= "3" >
<input type= "text" name= "Formno3" size= "3" maxlength= "3" >
<font color= "#CC0000" > *</font></font></td>
</tr>
<tr>
&LT;TD width= "32%" > <font size= "3" > Your e-mail:</font></td>
&LT;TD width= "68%" ><font size= "3" >
<input type= "text" name= "Formno4" maxlength= ">"
<font color= "#CC0000" > *</font></font></td>
</tr>
<tr>
&LT;TD width= "32%" > <font size= "3" > Your work Unit:</font></td>
&LT;TD width= "68%" ><font size= "3" >
<input type= "text" name= "Formno5" maxlength= ">"
</font></td>
</tr>
<tr>
&LT;TD width= "32%" ><font size= "3" > Your contact address:</font></td>
&LT;TD width= "68%" ><font size= "3" >
<input type= "text" name= "Formno6" maxlength= ">"
</font></td>
</tr>
<tr>
&LT;TD width= "32%" ><font size= "3" > Your postal code:</font></td>
&LT;TD width= "68%" >
<input type= "text" name= "Formno7" maxlength= "ten" >
</td>
</tr>
<tr>
&LT;TD width= "32%" ><font size= "3" > Your phone:</font></td>
&LT;TD width= "68%" >
<input type= "text" name= "Formno8" maxlength= ">"
</td>
</tr>
<tr>
&LT;TD width= "32%" ><font size= "3" > Your fax:</font></td>
&LT;TD width= "68%" >
<input type= "text" name= "Formno9" maxlength= ">"
</td>
</tr>
<tr>
&LT;TD width= "32%" ><font size= "3" > Your URL:</font></td>
&LT;TD width= "68%" >
<input type= "text" name= "Formno10" maxlength= ">"
</td>
</tr>
<tr>
&LT;TD width= "32%" valign= "Top" ><font size= "3" > comments or Requests:</font></td>
&LT;TD width= "68%" >
<textarea name= "formno11" cols= "rows=" 5 "></textarea>
<font color= "#CC0000" >*</font></td>
</tr>
<tr>
&LT;TD width= "32%" > </td>
&LT;TD width= "68%" >
<input Type=button value= "Send onclick=" javascript:save (); "Name= button" >


<input type= "Reset" name= "clear" value= "purge" >
</td>
</tr>
<tr>
&LT;TD colspan= "2" >
<p><br>
Note: Standard <font color= "#CC0000" >* </font> items are required. </p>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
?
}
?>
</body>



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.