Submit Forms Without CGI
By Stephen Bucaro
There are many reasons why you might not want to use CGI forms on your Web site.
For example your web site may be on a free host that does not allow custom CGI scripts.
You may want to conserve bandwidth on your Web server. Or maybe you just donít want
the hassle of CGI programming.
An alternative method to let visitors to your Web site submit forms is through
designing a form for email submission is not difficult. If you donít know either of
those things, you can still design your own email submission form if you can follow
the pattern of the code provided with this article.
The code provides an example of using checkboxes, a select list, and a text area
with an email submission form. If you can follow the pattern, you can edit the code
to your requirements, remove some elements, and add more of a different element.
a bit of processing to the formís data before submitting it to the users email program.
The first problem I found with submitting a form by email is that the formís action
property captures only the first input element of the form. So I added a hidden input
as the first element of the form. When the user clicks on the "Submit" button, the
elements of the form and places them in that first hidden element.
The second problem I found with submitting a form by email is that the formís data
is submitted in URL encoded format. It's possible to type any character into
a text box on a form, including slashes and other characters that have meaning in a
URL. Also, a URL canít have spaces. When you submit the form, the browser replaces
dangerous characters with other characters, and spaces are replaced with "+" signs.
creates a more understandable email message.
complicated than it is. You might want to make a second copy of the code, and in that
copy, remove all the escape characters to make the program more readable. The escape
characters used are listed below.
%0a = Line Feed
%0d = Carriage Return
%20 = Space