Using FormsZTI supplies our web hosting clients with a free-to-use web-form-to-email-message script. The script is called FormMail, and it is one of the most popular used on the Web. FormMail takes the fields which a user fills in on a Web page form, and turns it into a nice e-mail message which is sent to you. FormMail can either return a "thank you" page which you specify, or its own default "thank you" page. However since it is much more professional for you to provide a proper "thank you" page, we only give you the options on how to do that, and not how to specify how FormMail should present its own "thank you" page. You call FormMail from your <form> statement, as follows: <form action="/cgi-bin/formmail.cmd" method="POST"> Note that "POST" must be in capital letters. We then use several hidden fields in the form to tell FormMail what to do with the contents of the form. The most important of these is the Recipient, which is the email address that the form must be mailed to: <input type="hidden" name="recipient" value="webmaster@yourdomain.co.za"> We must also specify the "thank you" page that is returned to the user after they submit the form: <input type="hidden" name="redirect" value="http://www.yourdomain.co.za/thanks.html">
Now we need to know something about the user.
Your email address: <input type="text" size=30 name="email"> Your first name and surname: <input type="text" size=30 name="realname"> Then you can have your other fields in the form, like Comments, etc, or whatever else you want to know. FormMail also provides some more advanced features which may interest you. Else, you can skip ahead to the simple example. You can specify that certain fields MUST be filled in in the form. If they are not, you can specify a custom error page explaining so. <input type="hidden" name="required" value="email,realname"> <input type="hidden" name="missing_fields_redirect" value="http://www.yourdomain.co.za/error.html"> We can specify the order that the fields must appear in in the email message. This is usually the order in which they are sent by the browser, which is usually but not always the order in which they are on the Web page. You can select either alphabetic sorting or a specified order, as follows: <input type="hidden" name="sort" value="alphabetic"> or <input type="hidden" name="redirect" value="order:field1,field2,field3,etc.."> FormMail only sends the fields which have something filled in. If the browser actually sends these empty fields, and you want FormMail to print them, then you must specify so: <input type="hidden" name="print_blank_fields" value="1"> Lastly, advanced users may like to see which browsers their users are using: <input type="hidden" name="env_report" value="HTTP_USER_AGENT"> Simple example<form action="/cgi-bin/formmail.cmd" method="POST"><input type="hidden" name="recipient" value="webmaster@yourdomain.co.za"> <input type="hidden" name="redirect" value="http://www.yourdomain.co.za/thanks.html"> <input type="hidden" name="subject" value="Website feedback"> Your email address: <input type="text" size=30 name="email"> Your first name and surname: <input type="text" size=30 name="realname"> Your comments: <textarea name="comments" rows="4" cols="60"></textarea> <input type="submit" value="Send comments">
</form>
|