HTMLGoodies
The ultimate html resource
Earthweb.com


About the Double-Underlined Links


Become a Partner




Search Clipart.com:



internet.commerce















HTML Goodies : HTML and Graphics Tutorials : Forms Tutorial: A New Forms Solution Using Perl or FrontPage

HTML GOODIES TO GO NEWSLETTER


Other Related Newsletters

A New Forms Solution Using Perl or FrontPage


By Vince Barnes

Your Email forms Won't Work?
Is it because they're not supported?
Read on!

Some of the most common questions our mentor community is asked relate to Email Forms, aka Mailto Forms. These are HTML pages that include a form in which the site visitor can enter some information and send it via email to the intended recipient. There are several common uses for this type of form. They are often used as a feedback mechanism, whereby a visitor can send comments or suggestions about the site back to the webmaster. They are also used as a mechanism to capture data and send it off to a recipient at a remote location, bypassing the need for a database in or near the system where the site is being hosted. Webmasters come up with plenty of creative ways of using these forms, but increasingly over recent months, are also coming up against some problems.

The distinguishing characteristic of an email form is found in its "ACTION" statement in the <FORM> tag. There is a description of this type of form in the HTML Goodies Forms Tutorials

In the example on that page we see this "ACTION" statement:

<FORM METHOD="POST" ACTION="mailto:your email address">

The "ACTION" in this example is a "mailto:" with an email address. It is this which defines this form as an email form.

The problem arises because modern browsers, IE6 + and equivalent, no longer support email forms! The effect of this is that the visitor fills out the form and clicks the submit button and their email client program is invoked showing a blank email with the specified address in the "To" field. All information entered on the form appears to have been ignored. Essentially, these browsers are treating the email form as if it was a simple "Mailto" email link (for information about email links, see
the HTML Mailto: Primer

That's the problem, but like all good programmers all we see is an opportunity for a creative solution!

With that in mind, here are three solution offerings. The first is a solution primarily aimed at Unix (or similar) operating systems, and involves the use of CGI (Common Gateway Interface - see CGI Tutorials) and a mail system such as SENDMAIL (commonly installed on Unix and Linux systems.) The second is a little more specialized, in that it requires FrontPage Extensions, and the last, which uses ASP will only work for those of you who host your sites on Microsoft servers.

The first involves the use of a script to send the email form. One such script is the very popular formmail.pl originally available from Matt's Script Archive at
http://www.scriptarchive.com/formmail.html  although the most recent version, and most secure version, is now obtainable from the NMS project at http://nms-cgi.sourceforge.net/

 This script is accessed via the "ACTION" as in this example:

<FORM ACTION="/cgi-bin/formmail.pl" METHOD="POST">

There is a lot of comprehensive help information on Matt's site that describes very well how to use this script, so there is not much point in going into details here. There are a couple of things to point out, however. First, in order to use this script, the host system must support CGI and make it available to you. Check with your hosting company if you're not sure. Secondly, you would be well advised to heed the security advice that Matt offers. Formmail, being a popular script, is the target of a lot of exploitation. Some good sense precautions can go a long way to minimize the exposure. It is worth noting that most of the exploits become a problem for your hosting company more than for the website itself.

The second solution is available where FrontPage Extensions are available on the hosting server. The extensions will also need to have been configured to handle email. Again, check with your hosting company if you're not sure. Included in the FrontPage Extensions is a series of capabilities provided by what Microsoft calls "Webbots". If you use a FrontPage Extension aware editor to create your form, the program will provide you the ability to specify an email address to send the form data to as a property of the form. The program then generates the instructions needed to utilize the Webbot to send out your email. This is a very simple method, but does depend on the availability of the extensions and a suitable editing program (such as FrontPage itself.)

Next, I present a solution using one more technology, namely ASP. I have included a complete sample page with all code in place for you to try out.  This solution, being an ASP solution, will only work for those of you who have your sites hosted on a Microsoft platform.
 

Continue to Part 2


Tools:
Add htmlgoodies.com to your favorites
Add htmlgoodies.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed

IT Management Networking & Communications Web Development Hardware & Systems Software Development Earthwebnews.com



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
Avaya Article: Call Control XML - Powerful, Standards-Based Call Control
Tripwire Whitepaper: Seven Practical Steps to Mitigate Virtualization Security Risks
Internet.com eBook: The Pros and Cons of Outsourcing
Go Parallel Article: Scalable Parallelism with Intel(R) Threading Building Blocks
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
Go Parallel Article: James Reinders on the Intel Parallel Studio Beta Program
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Go Parallel Article: Getting Started with TBB on Windows
HP eBook: Storage Networking , Part 1
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Go Parallel Video: Intel(R) Threading Building Blocks: A New Method for Threading in C++
HP Video: Is Your Data Center Ready for a Real World Disaster?
Microsoft Partner Portal Video: Microsoft Gold Certified Partners Build Successful Practices
HP On Demand Webcast: Virtualization in Action
Go Parallel Video: Performance and Threading Tools for Game Developers
Rackspace Hosting Center: Customer Videos
Intel vPro Developer Virtual Bootcamp
HP Disaster-Proof Solutions eSeminar
HP On Demand Webcast: Discover the Benefits of Virtualization
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Microsoft Download: Silverlight 2 Software Development Kit Beta 2
30-Day Trial: SPAMfighter Exchange Module
Red Gate Download: SQL Toolbelt
Iron Speed Designer Application Generator
Microsoft Download: Silverlight 2 Beta 2 Runtime
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
IBM IT Innovation Article: Green Servers Provide a Competitive Advantage
Microsoft Article: Expression Web 2 for PHP Developers--Simplify Your PHP Applications
Featured Algorithm: Intel Threading Building Blocks - parallel_reduce
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES