The form handler, Mailform Extra: user guide

Mailform Extra

Example

This is an example of a simple form which uses the Mailform Extra service.

The form

The HTML code for the example form is:
<form method="POST"
action="http://qkxyq.com/thalasson/mailform.cgi/example_account">
<table cellpadding=8>
<tr>
<td>
<p>Please enter your comments here<br>
<textarea name="comment" rows=6 cols=48></textarea>
</td>
<td valign="top">
Your name:<br>
<input name="name" size="30">
<p>Your email address:<br>
<input name="email" size="30">
<p align="center"><input type="submit" value="send">
</td>
</tr>
</table>
</form>

This is how the form appears:

Please enter your comments here

Your name:

Your email address:

Tests on form fields

The form has three fields named name, email and comment. We want any form submitter to supply a properly formatted email address and also to enter something in the comment box. We can set up these conditions up in the Tests on form field values configuration page as follows:

field namecondition

Email layout

It is best to set up the email template first then the name of the relevant template can be given when the rest of the email is defined.

The following template uses braces {} as the insertion point delimiters. HTTP_REFERER will normally contain the address of the web page containing the form. REMOTE_ADDR and REMOTE_HOST give the internet address being used by the form submitter (not the email address).
form page: {HTTP_REFERER}

form submitter: {REMOTE_ADDR} {REMOTE_HOST}

--------- FORM DATA STARTS HERE ---------
name: {name}
email: {email}
comment:
{comment}
---------- FORM DATA ENDS HERE ----------

If we name the email template email then we can have something like the following specifying the email on the Email List configuration page. Note how the form submitter's email address, which is in the email form field, is placed in the From address by using an insertion point.

Email 1
To
From
Subject
Template

Acceptance page

The following is the template for a very simple acceptance response web page. It shows the use of insertion points to present the contents of the form in the page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<title>Mailform Extra, acceptance response</title>
<h1>Thank you for your comments</h1>
<h2>You entered:</h2>
<p>Your name: {name}
<p>Your email address: {email}
<p>You wrote:
<blockquote>{comment}</blockquote>

Rejection page

The rejection response web page reproduces the form with the original form field values set up as its initial values.

The message "You have not entered a valid email address." will only appear when the form submitter has indeed failed to enter a properly formatted email address and similarly "You made no comment." only appears if the form submitter did not enter anything in the comment box.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<title>Mailform Extra, rejection response</title>

<{email}><p>You have not entered a valid email address.</{email}>

<{comment}><p>You made no comment.</{comment}>

<div>
<form method="POST"
action="http://qkxyq.com/thalasson/mailform.cgi/example_account">
<table cellpadding=8>
<tr>
<td>
<p>Please enter your comments here<br>
<textarea name="comment" rows=6 cols=48>{comment}</textarea>
</td>
<td valign="top">
Your name:<br>
<input name="name" value="{name}" size="30">
<p>Your email address:<br>
<input name="email" value="{email}" size="30">
<p align="center"><input type="submit" value="send">
</td>
</tr>
</table>
</form>
</div>