Multiple Ezine Subscription Form Processing with Master Form V4
Master
One type of form ezine publishers will find useful allows a site visitor to subscribe to multiple ezines with one form.
This article is a how-to for multiple ezine subscription processing. It is a modified version of the "Subscription Form Processing with Master Form V4" article (listed with others in the "Related Articles" box on the right). NOTE: This form provides the means for subscribing, only.
Site visitors provide their email address (and name and other information, depending on the form you use). And they check the ezines they want to subscribe to. Then, Master
-
Updates a database with the submitted information.
-
Sends a subscription email to the list software/service of each ezine the site visitor checked. (The list software/services then handle the subscriptions.)
-
Sends an email to you, the webmaster.
-
Presents a "thank you" page to the form user.
Forms, emails, databases, and "thank you" pages can all be formatted the way you want and contain the information you want.
I'll show you how to do it, step by step. If anything is unclear, or if you wish to modify the examples provided here, please consult the Master
Multiple List Building with Master Form V4
First, make the form. Here is an example form you can use:
<form method="POST" action="/cgi-bin/mfv4/MasterFormV4.cgi"> <input type="hidden" name="requiredfields" value="email"> <input type="hidden" name="emailfields" value="email"> <input type="hidden" name="dbfile" value="data/multioptin_subscribers.csv"> <input type="hidden" name="filetemplate" value="templates/multioptin_subscriberdata.txt"> <input type="hidden" name="emailtemplate" value="templates/multioptin_webmasteremail.txt"> <input type="hidden" name="flowto" value="/multioptin_confirmation.html"> <p> <h3>Check the ezines that interest you!</h3> </p> <p> <input type="checkbox" name="emailtemplate" value="multioptin_ezine1_subscriptionemail.txt"> <b>The First Ezine</b><br> This is the first and the best — always has been, is now, and always will be. </p> <p> <input type="checkbox" name="emailtemplate" value="multioptin_ezine2_subscriptionemail.txt"> <b>The Almost Ezine</b><br> This one is almost as good. If you like "The First Ezine," you'll like this one, too. </p> <p> <input type="checkbox" name="emailtemplate" value="multioptin_ezine3_subscriptionemail.txt"> <b>Possibilities</b><br> No matter what the others say, this is the best. Nearly 300 weekly issues have been published since July 1999, and we're still going strong. It's the resource you can't do without. </p> <p> Email: <input type="text" name="email" style="width:200px;"> </p> <p> Name: <input type="text" name="name" style="width:200px;"> </p> <p> <input type="submit"> </p> </form>
Verify the URLs in the FORM tag and the hidden fields are correct. Adjust as necessary.
Here is how the above form would print on your web page.
The Hidden Form Fields
Below is a short explanation of each hidden field. If the hidden field refers to a template, an example is provided.
Hidden field name="requiredfields"
This hidden field's value contains a comma-separated list of the field names that are required to contain information before the form can be successfully submitted.
Hidden field name="emailfields"
This hidden field's value contains a comma-separated list of the field names that must contain a correctly formatted email address if they contain any information at all.
Hidden field name="dbfile"
Here is where the file name and location of the database is specified. Information submitted with the form is appended to the file, the file created if it doesn't already exist.
Hidden field name="filetemplate"
The template specified in this hidden field is used to prepare the data record prior to appending to the database file. Here is an example database record template:
**INITIALIZE_DATABASE_WITH_FIELD_NAMES** "[[WEEKDAY]], [[LONGMONTH]] [[DAY]], [[YEAR]]","[[HOUR2]]:[[MINUTE2]]:[[SECOND2]]","[[email]]","[[name]]","[[IP]]","[[emailtemplate SeparateWith(%0A)]]"
The above is a template for a comma-separated values (CSV) file, recording.
The first line of the template tells Master
The next line is the template for the data record. It provides for fields for
- the server date,
- the server time,
- the email address provided on the form,
- the name provided on the form,
- the IP address of the form user, and
- the names of the email template files that were used (a separate template is used for each ezine).
The last field records the file names of the webmaster email template and the email template of each ezine checked when the form was submitted. The template file names are separated with %0A ("0A" is the hex number for a line feed character, and the "%" preceding the hex number tells some programs to convert the hex number). A different separator may be specified. See the Master
Hidden field name="emailtemplate"
This email template is for you, the webmaster. (The email templates for the ezines are specified as the values of the ezine checkbox fields.)
Here is an example email template for the webmaster:
From: [[email]] To: webmaster@example.com Subject: Multi-List Subscription! This was submitted: [[if_name]]Name: [name]][[/if_name]] Email: [[email]] IP Address [[IP]] Email template files used: ~~ [[emailtemplate SeparateWith( ~~ )]]
Hidden field name="flowto"
If you do not wish to have the "thank you" page personalized, use hidden field name="redirect" instead of name="flowto"
When hidden field name="flowto" is used, Master
Here is an example "thank you" web page template:
<html> <body> <p> Your subscription has been accepted[[if_name]], [[name]][[/if_name]]. </p> <p> It is is recorded as [[email]] </p> </body> </html>
The Visible Form Fields
The visible form fields are the checkboxes, the text fields, and the submit button.
The field names of the ezine checkboxes are all name="emailtemplate"
You'll note that is the same field name as the hidden field that specifies which template to use when sending the webmaster email.
When an ezine checkbox is checked, the checkbox is added to the name="emailtemplate" values list. The value of the checkbox is the location of the email template to use when subscribing to that particular ezine.
(When the form is submitted, Master
Here is an example email template that might be sent to the ezine software/service when the form user checks a checkbox. The example includes a Bcc: line for the webmaster to receive a copy.
Return-Path: <[[email]]> From: [[if_name]]"[name]]" [[/if_name]]<[[email]]> Reply-To: [[if_name]]"[name]]" [[/if_name]]<[[email]]> To: listserver@example.com Bcc: webmaster@example.com Subject: Subscribe [[email]] Subscribe [[email]]
Implementation
Put the web page form on your server, and the templates in the locations specified in the form's hidden fields
Then test it. Verify that all emails are sent and the database is updated.
When it works the way you want it to, and you're ready to do so, put the form on a publicly accessible web page and link to it.
Will Bontrager