Source code of the feedback form made using PHP

Source: Internet
Author: User

This is an opinion feedback table created using PHP. It can be used for Online Mailing programs with slight modifications. It mainly allows visitors to fill out forms and send them to the Administrator's mailbox after processing them using PHP, send a confirmation letter to the visitor's mailbox.
About. php
-------------------------
<Html>
<Head>
<Title> feedback form </title>
</Head>
<Body>
<? Php
$ Adminmail = "admin@acme.oso.com.cn"; # administrator mailbox
$ Pagename = "Acme"; # Home Page name
$ Pageline = "http://acme.oso.com.cn"; # Home Address
# Administrator letter content
If ($ formno1! = "") And ($ formno4! = "") And ($ formno11! = "")){
$ Email = $ formno4; # client E-mail
$ Sender = $ formno1; # sender
$ 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. "-feedback form> nn ");
Fwrite ($ fp, "courier:". $ sender. "n sending IP:". $ REMOTE_ADDR. "n sending time:". $ nowtime. "nn ");
Fwrite ($ fp, "Feedback Form details: n ---------------------------------------------------------- n ");
Fwrite ($ fp, "Name :". $ formno1. "n Gender :". $ formno2. "n age :". $ formno3. "nE-mail :". $ formno4. "n unit :". $ formno5. "n contact address :". $ formno6. "n zip code :". $ formno7. "n :". $ formno8. "n Fax :". $ formno9. "n URL :". $ formno10. "n suggestion :". $ 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 );
# Incoming mail content;
$ Tmpfilename1 = tempnam ("./tmp", "dm ");
$ Fp = fopen ($ tmpfilename1, "w ");
Fwrite ($ fp, "From:". $ adminmail. "n ");
Fwrite ($ fp, "Subject: <feedback form> nn" you entered in [". $ pagename ");
Fwrite ($ fp, "***** this message is an automatic reply letter. Please do not reply. We apologize for the inconvenience. * *** Nn ---------------------------------------------------------- n Thank you very much for entering the feedback form in [". $ pagename! N The following is the details you fill in ". $ nowtime.", please confirm: n ------------------------------------------------------ n ");
Fwrite ($ fp, "Name :". $ formno1. "n Gender :". $ formno2. "n age :". $ formno3. "nE-mail :". $ formno4. "n unit :". $ formno5. "n contact address :". $ formno6. "n zip code :". $ formno7. "n :". $ formno8. "n Fax :". $ formno9. "n URL :". $ formno10. "n suggestion :". $ formno11. "n ------------------------------------------------------ n ". $ pagename. ":". $ pageline. "nE-mail :". $ adminmail );
Fclose ($ fp );
$ Execstr = "cat". $ tmpfilename1. "|/usr/sbin/sendmail". $ Email;
Exec ($ execstr );
# The confirmation page starts;
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 entering the feedback form in <a href = $ pageline> $ pagename </a>.! * ** </B> </font> </p> the following information is provided: <B> name: </B> $ formno1 <br>
<B> Gender: </B> $ forno2 <br>
<B> Age: </B> $ formno3 <br>
<B> Email: </B> $ formno4 <br>
<B> Work Unit: </B> $ formno5 <br>
<B> contact address: </B> $ formno6 <br>
<B> zip code: </B> $ formno7 <br>
<B> Tel: </B> $ formno8 <br>
<B> Fax: </B> $ formno9 <br>
<B> website: </B> $ formno10 <br>
<B> suggestion: </B> $ formno11 <br>
<Font color = #993333> Thank you !!! </Font>
<Hr> <input TYPE = button VALUE = return Previous Page onClick = history. go (-1); return true;>
<P align = center> <font size = 3> $ pagename </font>: <a href = $ pageline> $ pageline </a> </p> </font> <p>
";
# The confirmation page ends;
} Else {
?>
<Script language = javascript>
Function save (){
If (f1.formno1. value! = "" & F1.formanganese. value! = "" & F1.formno3. value! = "" & F1.formno4. value! = "" & F1.formno11. value! = ""){
F1.submit ();
}
Else {
Alert ("with * is required. Please fill in all and submit again. Thank you for your cooperation! ");
}
}
</Script>
<P align = "center"> <font size = "5" color = "#009999"> View the feedback table </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>
<Td width = "32%"> <font size = "3"> your name: </font> <font size = "3">
<Font color = "# CC0000"> </font> </td>
<Td width = "68%"> <font size = "3">
<Input type = "text" name = "formno1" size = "8">
<Font color = "# CC0000"> * </font> </td>
</Tr>
<Tr>
<Td width = "32%"> <font size = "3"> your gender: </font> </td>
<Td width = "68%"> <font size = "3">
<Select name = "formanganese">
<Option value = "male"> male </option>
<Option value = ""> female </option>
</Select>
<Font color = "# CC0000"> * </font> </td>
</Tr>
<Tr>
<Td width = "32%"> <font size = "3"> your age: </font> </td>
<Td width = "68%"> <font size = "3">
<Input type = "text" name = "formno3" size = "3" maxlength = "3">
<Font color = "# CC0000"> * </font> </td>
</Tr>
<Tr>
<Td width = "32%"> <font size = "3"> your email: </font> </td>
<Td width = "68%"> <font size = "3">
<Input type = "text" name = "formno4" maxlength = "40">
<Font color = "# CC0000"> * </font> </td>
</Tr>
<Tr>
<Td width = "32%"> <font size = "3"> your work unit: </font> </td>
<Td width = "68%"> <font size = "3">
<Input type = "text" name = "formno5" maxlength = "100">
</Font> </td>
</Tr>
<Tr>
<Td width = "32%"> <font size = "3"> contact address: </font> </td>
<Td width = "68%"> <font size = "3">
<Input type = "text" name = "formno6" maxlength = "100">
</Font> </td>
</Tr>
<Tr>
<Td width = "32%"> <font size = "3"> your zip code: </font> </td>
& Lt; td width = "68%" & gt;
<Input type = "text" name = "formno7" maxlength = "10">
</Td>
</Tr>
<Tr>
<Td width = "32%"> <font size = "3"> your phone number: </font> </td>
& Lt; td width = "68%" & gt;
<Input type = "text" name = "formno8" maxlength = "20">
</Td>
</Tr>
<Tr>
<Td width = "32%"> <font size = "3"> your Fax: </font> </td>
& Lt; td width = "68%" & gt;
<Input type = "text" name = "formno9" maxlength = "20">
</Td>
</Tr>
<Tr>
<Td width = "32%"> <font size = "3"> your website: </font> </td>
& Lt; td width = "68%" & gt;
<Input type = "text" name = "formno10" maxlength = "100">
</Td>
</Tr>
<Tr>
<Td width = "32%" valign = "top"> <font size = "3"> comments or requirements: </font> </td>
& Lt; td width = "68%" & gt;
<Textarea name = "formno11" cols = "30" rows = "5"> </textarea>
<Font color = "# CC0000"> * </font> </td>
</Tr>
<Tr>
<Td width = "32%"> </td>
& Lt; td width = "68%" & gt;
<Input type = button value = "send" onClick = "javascript: save ();" name = "button">
<Input type = "reset" name = "clear" value = "clear">
</Td>
</Tr>
<Tr>
<Td colspan = "2">
<P> <br>
Note: The <font color = "# CC0000"> * </font> project is required. </P>
</Td>
</Tr>
</Table>
</Form>
</Td>
</Tr>
</Table>
<?
}
?>
</Body>
</Html>

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.