Accessibility

Dreamweaver Article

 

Building a subscribe/unsubscribe app in PHP with Dreamweaver CS3


Joseph Lowery

Joseph Lowery

jlowery@idest.com

Table of Contents

Created:
21 January 2008
User Level:
Intermediate, Advanced
Products:
Dreamweaver

E-mail newsletters are a very popular method of maintaining an open channel of communication with your site visitors. Newsletters are beneficial for commercial and non-profit sites alike. They have the great benefit of keeping a site's current user base up-to-date on the latest news and offerings from an organization. Moreover, they have the potential for turning site visitors into site customers or donators.

For newsletters to be successful logistically, they have to be easy to subscribe to and—just as importantly—unsubscribe from. With a straightforward entry and exit strategy, many online viewers, leery of incurring additional e-mail spam, will steer clear.

In this article, you'll learn how to create a complete subscribe/unsubscribe application in PHP/MySQL with a standard Dreamweaver CS3 server and just one additional block of code. To use this application, a user signs up for a subscription on a site and receives a confirmation e-mail. The e-mail contains a link to unsubscribe, personalized for the user. In all, you'll need to create five pages to achieve this functionality:

  • Subscribe.php: This page is comprised of a basic form that gathers an e-mail address and inserts a new record into the MySQL database. After the record is inserted the page is redirected to confirm_subscribe.php.
  • Confirm_subscribe.php: Although the visitor sees a bit of text confirming his or her subscription on this page, a PHP function contained within e-mails the user a secondary confirmation, which contains a link to unsubscribe via the confirm_unsubscribe.php page.
  • Error_subscribe.php: This is an error page that displays when the e-mail attempt was not successful; it also contains a link to the subscribe.php page so another attempt can be made.
  • Confirm_unsubscribe.php: This page is displayed when the visitor requests to unsubscribe. It displays the user's e-mail address and a form button to confirm the user's wish to unsubscribe; when clicked the user's record is deleted from the database and the visitor is redirected to the unsubscribe_complete.php page.
  • Unsubscribe_complete.php: The final page in the application acknowledges that the user has unsubscribed.

Requirements

In order to make the most of this article, you need the following software and files:

Dreamweaver CS3

Sample files:

Prerequisite knowledge

You'll need to know how to set up a dynamic site in Dreamweaver CS3 and also have PHP and MySQL set up on your development system.

Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License

About the author

Joseph Lowery's books about the web and web-building tools are international bestsellers, having sold more than 400,000 copies worldwide in eleven different languages. His most recent book is the Dreamweaver CS3 Bible. Joseph is the author of the recently published CSS Hacks and Filters as well as the co-author of Dreamweaver 8 Recipes with Eric Ott. A well-known speaker, he was presented at Adobe (formerly Macromedia) conferences in the United States and Europe as well as user groups around the country. Joseph is currently the Vice President of Marketing for WebAssist.