Feedback Form Script
Before you write your first PHP program, make sure that that your website is running on a web host that runs PHP 4.1 or above.
2.
You may also find it useful to have a copy of PHP 4.1 or later installed on your own computer. This makes testing your PHP scripts much easier.
3.
And of course, you need an ASCII text editor of some kind (such as Notepad on Windows).
4.
This tutorial also assumes that you have at least some knowledge of HTML. This is necessary because if I have to explain all the HTML tags as well, this tutorial will wind up being tediously long.
I will begin with a very rudimentary (but working) PHP script to take input from a feedback form and send it to you in an email message. This type of form is sometimes referred to as a FormMail or Form to Mail script. In later articles, I will develop that script (and others) to include features commonly found in such FormMail scripts.
If you are programming-savvy, you will recognize this as a sort of "Hello World" program, but infinitely more useful!
Writing the Feedback Form
The first thing we need to do is to write the feedback form itself. Put the following code in the section of an HTML file named, say, feedback.html.
Code:
<form method="post" action="sendmail.php">
Email: <input name="email" type="text" /><br />
Message:<br />
<textarea name="message" rows="15" cols="40">
</textarea><br />
<input type="submit" />
</form>
Basically the form asks the visitor for his email address (the field named "email" found in input name="email" above) and message (the field named "message" found in textarea name="message"), and presents him with a button which he can click to submit the contents of the form. When the form is submitted, it is "posted" (see the "method" attribute of the