In this article I explain how to create a simple feedback form, and how to send the data entered on that form to an email address.
Two web pages need to be produced to perform this task:
feedback.htm - the feedback form itself, and processData.php - the form handler that processes the data entered on the form:
feedback.htm
This is the form presented to the web site visitor. There are only three fields, but you could obviously have as many as you wanted to on your own form.
When the web site visitor clicks the Send Feedback button, the data entered into the three fields is sent to processData.php.
processData.php
(Please note: lines 11 to 16 should really include a few backslash n's to introduce a few line breaks into the email message. Unfortunately, due to display considerations, I had to drop them from this sample code.)
There are two main areas to this web page: a PHP script at the top and an HTML area at the bottom. The PHP script gets the data from the form and puts them into three variables ($title, $comments, and $from). A subject variable ($subject) is also defined. The PHP mail function processes these variables and generates an email message that is sent to the email address defined in $email.
The bit of HTML at the bottom of the web page simply displays a message to the web site visitor after the email has been sent. If you face any problem in getting firm for this work to complete then come to the world of webdhoom.com