Software, your way.
How To Get Good Custom Software
(Download)
(PDF)
burger menu icon
WillMaster

WillMaster > LibraryOur Software in Action >  >Master Form V4 in Action

FREE! Coding tips, tricks, and treasures.

Possibilities weekly ezine

Get the weekly email website developers read:

 

Your email address

name@example.com
YES! Send Possibilities every week!

Double Opt-In Subscriptions with Master Form V4

One of the many different kinds of forms that Master Form V4 can process for you is a double opt-in subscription form.

Potential subscribers provide their email address (and name and other information, depending on the form you use). When the form is submitted, Master Form V4 takes these steps:

  1. Updates a database with the submitted information.

  2. Sends an email to the subscriber with a link to confirm the subscription.

  3. Sends an email to you, the webmaster.

  4. Presents a "thank you" page to the prospective subscriber. The page would probably contain a reminder that an email has been sent and that the link in the email must be clicked to confirm the subscription.

The link in the new subscriber's email goes to a webpage on your site; loading the webpage causes a form to be submitted automatically to Master Form V4.

Then Master Form V4 takes these steps:

  1. Updates a database with the submitted information. This confirmation database would be a different file than the initial subscription database.

  2. Sends a subscription email to the list software/service. (The list software/service then handles the subscription after it receives the email.)

  3. Sends an email to the new subscriber. The email would probably contain an acknowledgement that the subscription has been confirmed.

  4. Sends an email to you, the webmaster.

  5. Presents a "thank you" page to the new subscriber.

Forms, emails, databases, and "thank you" pages can be customized with the format and information you want. Emails and web pages can be personalized.

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 Form V4 Manual.

Double Opt-In List Building with Master Form V4

As indicated above, the double opt-in process requires two cycles of interaction with Master Form V4.

The first cycle is when the site visitor fills in the form to subscribe to the ezine. This is the initial subscription.

After the initial subscription, the prospective subscriber must confirm that s/he meant to subscribe to the ezine. This is the subscription confirmation.

The Initial Subscription

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,name">
<input type="hidden" name="emailfields" value="email">
<input type="hidden" name="dbfile" value="data/doubleoptin_subscribers.csv">
<input type="hidden" name="filetemplate" value="templates/doubleoptin_subscriberdata.txt">
<input type="hidden" name="emailtemplate" value="templates/doubleoptin_subscriberemail.txt">
<input type="hidden" name="emailtemplate" value="templates/doubleoptin_webmasteremail.txt">
<input type="hidden" name="flowto" value="/doubleoptin_confirmation.html">
<p>
Your email address: 
<input type="text" name="email" style="width:200px;">
</p>
<p>
Your 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.

Your email address:

Your name:

Below is an explanation of each hidden field, along with an example if the hidden field refers to a template.

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 prepared 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]]"

The above is a template for a comma-separated values (CSV) database file, recording —

  • the server date,
  • the server time,
  • the email address provided on the form,
  • the name provided on the form, and
  • the IP address of the form user.

The first line of the template tells Master Form V4 to print an initial record of field names whenever it creates a new database file.

Hidden field name="emailtemplate" (twice)

Two email templates are used, one for the prospective subscriber and one for you, the webmaster.

Here is an example email template for the subscriber:

To: [[email]]
From: "Ezine LLC" <ezine@example.com>
Subject: Request for Ezine subscription confirmation

It is necessary to confirm your request to be a subscriber of Ezine.

To confirm your subscription, click this link:

http://example.com/confirm.html?[[email]]

Thank you!

Webmaster
Ezine LLC

The confirmation URL is a link to the web page where the automatically-submitting subscription confirmation form is located. (You'll read about that form in the "The Subscription Confirmation" section, below.) The question mark and placeholder at the end of the confirmation link URL causes the subscriber's email address to be part of the link URL.

Here is an example email template to be sent to you, the webmaster:

From: [[email]]
To: webmaster@example.com
Subject: Opt-In Subscription!

This was submitted:

[[if_name]]Name: [[name]][[/if_name]]
Email: [[email]]

IP Address [[IP]]

If you prefer to receive a copy of the email sent to the prospective subscriber, instead of (or in addition to) the above second email, the subscriber's email can have a Bcc: line added to it. Here is an example:

To: [[email]]
Bcc: webmaster@example.com
From: "Ezine LLC" <ezine@example.com>
Subject: Request for Ezine subscription confirmation

It is necessary to confirm your request to be a subscriber of Ezine.

To confirm your subscription, click this link:

http://example.com/confirm.html?[[email]]

Thank you!

Webmaster
Ezine LLC

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 Form V4 retrieves the template web page at the URL, personalizes/customizes it, then displays the modified web page in the user's browser.

Here is an example template:

<html>
<body>
<p>
Thank you[[if_name]], [[name]][[/if_name]]!<br>
A request for confirmation has been sent to [[email]].<br>
Confirmation is required.
</p>
</body>
</html>

Initial Subscription 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 — except for the subscription confirmation link. The confirmation link will be tested in the next implementation phase. Verify that all emails are sent and the database is updated.

When it works the way you want it to, implement the subscription confirmation part of the process.

The Subscription Confirmation

The confirmation link to be clicked by the new subscriber is a URL with the subscriber's email address appended (see 'The Initial Subscription — Hidden field name="emailtemplate"' above). The web page at the URL contains JavaScript to read the address appended to the URL and insert the address into a hidden field of an automatically-submitting form.

Here is an example of such a web page:

<html>
<body>

<script type="text/javascript" language="JavaScript">
<!-- Copyright 2005 Bontrager Connection, LLC
Addy = new String();
var thisurl = document.URL;
var questionlocation = thisurl.indexOf('?');
if(questionlocation > 0) { Addy = thisurl.substr(questionlocation + 1); }
if(Addy.length > 0) { Addy = unescape(Addy); }
//-->
</script>

<form name="autoConformOptIn" method="POST" action="/cgi-bin/v4/MasterFormV4.cgi">
<input type="hidden" name="requiredfields" value="email">
<input type="hidden" name="emailfields" value="email">
<input type="hidden" name="dbfile" value="data/doubleoptinconfirmation_signup.csv">
<input type="hidden" name="filetemplate" value="templates/doubleoptin_confirmationdata.txt">
<input type="hidden" name="emailtemplate" value="templates/doubleoptin_listserveremail.txt">
<input type="hidden" name="emailtemplate" value="templates/doubleoptin_subscriberconfirmedemail.txt">
<input type="hidden" name="emailtemplate" value="templates/doubleoptin_webmasterconfirmationemail.txt">
<input type="hidden" name="flowto" value="/doubleoptin_confirmation.html">

<script type="text/javascript" language="JavaScript"><!--
if(Addy.length > 0) { 
	document.write('<input type="hidden" name="email">');
	}
else {
	document.write('<p>Please provide the email address you are confirming:<br>');
	document.write('<input type="text" name="email" style="width:200px;"></p>');
	document.write('<p><input type="submit" value="Confirm"></p>');
	}
//--></script>

<noscript>
<p>Please provide the email address you are confirming:<br>
<input type="text" name="email" style="width:200px;"></p>
<p><input type="submit" value="Confirm"></p>
</noscript>

</form>

<script type="text/javascript" language="JavaScript"><!--
if(Addy.length > 0) { 
	document.autoConformOptIn.email.value = Addy;
	document.autoConformOptIn.submit();
	}
//--></script>

</body>
</html>

Verify the URLs in the FORM tag and the hidden fields are correct. Adjust as necessary.

The confirmation form automatically submits if the subscriber's browser is JavaScript-enabled and an email address was appended to the link URL. Otherwise, a form will print on the page. In that case, here is how the above form would print.

Please provide the email address you are confirming:

Four templates are specified in hidden fields of the above automatically-submitting form. One is a database template. Two are email templates, new subscriber and webmaster. And one is a "thank you" web page template.

The database template

Below is an example database template. Although this example is identical to the example database for the initial subscription, they do not have to be identical. The database for the initial subscription and the database for subscription confirmation should, in most circumstances, be separate files.

**INITIALIZE_DATABASE_WITH_FIELD_NAMES**
"[[WEEKDAY]], [[LONGMONTH]] [[DAY]], [[YEAR]]","[[HOUR2]]:[[MINUTE2]]:[[SECOND2]]","[[email]]","[[name]]","[[IP]]"

The subscriber email template

The email the new subscriber receives might be generated from a template something like this:

To: [[email]]
From: "Ezine LLC" <ezine@example.com>
Subject: Your Ezine subscription has been confirmation

You are now a confirmed Ezine subscriber. Welcome aboard!

To show our appreciation, we're making available ...

Thank you!

Webmaster
Ezine LLC

The webmaster email template

Here is an example template for the webmaster's email:

From: [[email]]
To: webmaster@example.com
Subject: Opt-In Subscription Confirmation!

[[email]] was confirmed.

IP Address [[IP]]

The "thank you" web page template

The "thank you" page could be personalized with the new subscriber's email address. Here is an example template:

<html>
<body>
<p align="center" style="font-size: 22px;">
Your confirmation has been accepted.
<br><br>
The subscription is recorded for [[email]]
</p>
</body>
</html>

Subscription Confirmation Implementation

Put the web page form on your server, and the templates in the locations specified in the form's hidden fields

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

Was this article helpful to you?
(anonymous form)

Support This Website

Some of our support is from people like you who see the value of all that's offered for FREE at this website.

"Yes, let me contribute."

Amount (USD):

Tap to Choose
Contribution
Method

All information in WillMaster Library articles is presented AS-IS.

Support Area – Ask Your Question Here

The "Code in articles help" forum at the Willmaster.com support area is the place to get information about implementing JavaScript and other software code found on Willmaster.com

We only suggest and recommend what we believe is of value. As remuneration for the time and research involved to provide quality links, we generally use affiliate links when we can. Whenever we link to something not our own, you should assume they are affiliate links or that we benefit in some way.

Need Custom Software?
Click to
tell us about
your project.

How Can We Help You? balloons
How Can We Help You?
bullet Custom Programming
bullet Ready-Made Software
bullet Technical Support
bullet Possibilities Newsletter
bullet Website "How-To" Info
bullet Useful Information List

© 1998-2001 William and Mari Bontrager
© 2001-2011 Bontrager Connection, LLC
© 2011-2024 Will Bontrager Software LLC