Return CGI Library
This gadget allows you to setup order forms, feed-back forms and the like. The data from the form is e-mailed to an account that you
specify.
The first thing to do is build the form and 'point it' at the formmail program.
I've built a sample for this demo. This is the form.
And here is what the HTML looks like . (It's just a simple computer order form.
A more useful implementation would be to feed an 'instant' estimate back to a customer... but that isn't what this page is here to
discuss :)
I will leave off a tutorial on forms to another time (or refer you to the Internet at large). We are interested in the following
details:
The <form action=...>
This field specifies where the form values get sent by the browser. We set this as follows:
<form action="/cgi-bin/mail" method="post">
The recipient value:
The purpose of this script is to convert a form to e-mail, which means that we need to have an e-mail address to send the results to.
We do that with a hidden field as follows:
<input name="recipient" type="hidden" value="yourid@yourdomain" />
Note: All mail sent through this gadget (which has been abused by spammers), will be queued and scanned by a human UNLESS
you send it to an address at yourdomain. If you want it delivered to your ISP, please configure a forwarding address (see the
VMAIL instructions).
Those are the only mandatory fields. The following predefined fields are optional, but add significantly to the value of the
form. Any other fields that you define are automatically sent to you in the e-mail message.
Subject:
We specify the subject of the mail message with a hidden field using a line like the following:
<input name="subject" type="hidden" value="formmail demo" />
Redirect:
This is another hidden field that is used to specify a URL that the client browser should go to after submitting the form. Usually
this would be a thank you note of some type (silly example.)
(Note that this has to be fully qualified, as the default directory is /cgi-bin during the redirect.)
<input name="redirect" type="hidden" value="/gadgets/formmail/thanks.html" />
Username:
We might give the client a field to enter their e-mail ID. This will be used as a return address for the message you get.
<input name="username" type="text" size="40" />
Realname:
We might give the client a field to enter their real name (as compared to their e-mail id). This will also be used in the return
address you received.
<input name="realname" type="text" size="40" />
|