PERFECTPHP E-mail Receive Form Electronic Content Text
There are a number of ways you can process an HTML web form to capture
information entered by someone visiting your web site. PHP, with
its built-in e-mail function, offers one of the simplest ways to capture
such user data. And PHP is rapidly gaining in popularity, so it's
easy to find a web hosting company that supports PHP.Very Basic PHP ScriptPERFECT is a small and efficient PHP script that processes an HTML web form and sends the information in an e-mail message to a predefined recipient.
Searches the form ("post" data) to find all input fields so that you can modify the HTML web form without having to change the PHP script. User Host and Browser: Message includes user's host and browser information. Hidden E-Mail Address: E-mail address used by the script is hidden for your protection. Safe E-Mail Content: Content of message is stripped of special characters in the off chance that someone attempts to submit malicious content. Easy Configuration: Script is easily configured by editing the setup variables at the top of the script. No Cost: You are free to use and modify the PERFECT script as you like (it's open source). PERFECT Script: feedback.php<?php
////////////////////////////////////////////////////////////////
// PERFECT //
// ------- //
// PHP E-mail Receive Form Electronic Content Text //
// File: feedback.php //
// Version: 1.8 (April 21, 2008) //
// Description: Processes a web form to read the user input //
// and then send the data to a predefined recipient. You //
// are free to use and modify this script as you like. //
// Instructions: Go to "http://www.centerkey.com/php". //
// License: Public Domain Software //
// //
// Center Key Software * www.centerkey.com * Dem Pilafian //
////////////////////////////////////////////////////////////////
// Configuration Settings
$SendFrom = "Form Feedback <feedback@yourdomain.com>";
$SendTo = "feedback@yourdomain.com";
$SubjectLine = "Feedback Submission";
$ThanksURL = "thanks.html"; //confirmation page
// Build Message Body from Web Form Input
foreach ($_POST as $Field=>$Value)
$MsgBody .= "$Field: $Value\n";
$MsgBody .= "\n" . @gethostbyaddr($_SERVER["REMOTE_ADDR"]) . "\n" .
$_SERVER["HTTP_USER_AGENT"];
$MsgBody = htmlspecialchars($MsgBody, ENT_NOQUOTES); //make safe
// Send E-Mail and Direct Browser to Confirmation Page
mail($SendTo, $SubjectLine, $MsgBody, "From: $SendFrom");
header("Location: $ThanksURL");
?>
Sample HTML Web Form<html>
<head>
<title>Comment Page</title>
</head>
<body>
<form method=post action="feedback.php">
Your Name: <input type=text name="Name" size=25><br>
Your E-Mail: <input type=text name="EMail" size=30><br>
Your Comment: <textarea name="Comment" rows=4 cols=30></textarea><br>
<input type=submit value="Submit Feedback">
</form>
</body>
</html>
Sample Feedback MessageTo: feedback@yourdomain.com
Subject: Feedback Submission
From: Form Feedback <feedback@yourdomain.com>
Date: Sun, 20 Jan 2008 17:07:26 -0400
Name: Susie
EMail: sample@yahoo.com
Comment: I wish your web site offered search by brand.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko Firefox/1.0
8214.dsl.isp.net
Instructions (Tutorial)To use PERFECT on your web site:
Questions or CommentsAll the fields are optional. However, if you want a response, make sure to provide your e-mail address.Style sheets (CSS) make it much easier to customize the colors and layout of your web form. Here's the HTML code with styles for the above form. Random
"Thank you so much for this wonderful script. You are tha best!!!"
Q.D., February 5, 2007 "You're awsome! Thanks a lot for an easy-to-use script." B.V., January 24, 2008 "My first 'successful' email form script after trying many. Thanks so much." J.B.J.R, November 4, 2007 "You are a god!!!!!! Thanks man i have been looking all over for a easy script like this" M., Octobr 22, 2007 "THANK YOU for such a SIMPLE script! None of this 100+ feature stuff. I love it -- thanks!" S., October 3, 2007 "Wow... it is perfect! I have been searching something so simple and efficient for a loooong time! Now forms are fun. Thank you! :)" A., September 14, 2007 "It is a simple form, exactly what I need. Thanks!" S.M., July 18, 2007 "Your PERFECT email script is the best script I have EVER used! It made my life so much easier!!!! I was struggling with an old Perl script and finally gave up and searched for something easier to use. Then I came across this script and I'm amazed at its simplicity! Who knew it could be so elegantly easy????? Thank YOU!!!!!!!!!!!!!!!!!!!!" D., July 16, 2007 "I'm using you php email script thank you so much It work perfectly." S.G., June 19, 2007 "thanks so much for a great script!" M., June 17, 2007 "Super, great, fantastic, fab, all words that sprang to mind as soon as this worked. And it worked first time! Great stuff." C., May 2, 2007 "Once of the most simplest & easiest & most useable scripts have come across after loads of time spent on net" S., November 29, 2006 "Eazy as pie" C.B., October 16, 2006 "how easy was that! Brilliant thanks very much" M.R., October 2, 2006 "Wonderfullly good. The simplest structured script for a form mailer. Wondefull Thank you very much" S.K.T.K., September 28, 2006 "Your great little script does exactly what I wanted - it is really neat. Thanks" A.M., August 14, 2006 "After looking at a dozen complicated scripts, thinking, this is ridiculous, it should be easy, I finally found your perfect form mailer. Thanks." Y.J., May 15, 2006 "great script, exactly what I was looking for." S., March 13, 2006 "Thank you! I've been trying to get my forms to work with my new server and your web page helped me tremendously. How long I've searched the net for the answer. I feel like I owe you one." L.W., February 20, 2006 "thank you" P., February 2, 2006 "a very good scipt" B.W., February 1, 2006 "Good Script" C., January 13, 2006 "yes u r really good" D.S.M., December 18, 2005 "Works Perfectly - thank you so much" M.Z., November 27, 2005 "Neato Thanks!" B., November 20, 2005 "Thats cool" C.M., November 9, 2005 "...This is a great script. Thank you." D., October 26, 2005 "Sure enough, I tried it, and it works wonderfully! I hate using the FormMail perl script! Thanks!" D., September 1, 2005 "You totally rock! That worked." C.L., August 2, 2005 "Wonderful, this makes everything much more simple. Will get good use out of it" H.T., July 11, 2005 "nice script" Anonymous, July 2, 2005 "Hi there, This is it. Looked everywhere. This is simple AND Works! Thanks" R.v.D, June 7, 2005 "PERFECT works great. Thank you." I.U., June 7, 2005 "I spent days fooling with other scripts. I installed them, only to find that they didn't work. Then I found PERFECT, and it works, well, PERFECTly!" Z., May 6, 2005 "This is SO much easier than mucking about with CGI. Thanks!" L.R., April 17, 2005 "Good teaching of these scripts." C., April 14, 2005 "awsome, it not only solve my problem, it also let me do whatever form customization that i want, thx" R.Y., April 5, 2005 "OMG! I spent 3 hours browsing google looking for a script to do this. Finally, I clicked on this link and ~BAM!~ it's JUST what I need. You were more helpful than the company I bought my site from! Thank you SOOOOO much!!!" B., April 5, 2005 "Nice one. Just what I was looking for; short and sweet. Big thanks..." R.J.H., March 27, 2005 "Awesome. Best. Short, Sweet, Fully packed. Thanksamundo!" C.J., March 26, 2005 "this script is crazy smart. Evil almost. Thanks." R.S., February 23, 2005 "...I love your script!..." D.R., February 7, 2005 "I like your script. It's very easy to use..." K.H., January 25, 2005 "Oh, this script is the best, for sure. Simple, powerful, and easy to understand, just like PHP is. Congratulation for your good work and cleverness." F., December 31, 2004 "...it works great.,,,,thanks for everything." N., September 20, 2004 "Hello! Thank you for your quick and simple email form script!..." E., September 14, 2004 "Your form processor is FAB! I take my hat off to you!" D., September 7, 2004 "Great and simple script as you said. Just tried it and thank you..." M.V., September 2, 2004 "finally a short and effective script! THX a lot for putting it out there." A., August 12, 2004
| ||||