Everybody uses online forms these days, whether to get user feedback or to get orders. They present your visitors with a means to convey their message to you.Most of webmasters prefer using CGI scripts for processing and emailing form inputs. Such scripts are copiously available, mostly free, at various free-scripts resources on Net. Most of CGI happens in Perl, so you gotta be in friendly terms with scripting language in order to fine tune form-handling script according to your own, special needs.
A better alternative is, using either ASP or PHP. Both scripting languages are easy to use and require less coding. In Perl, if you write a routine in 50 lines, same routine can be written, in say, 10 lines in ASP.
In this article I'm going to tell you how to write an HTML-form handling script in ASP. This script does two things - it emails you details entered by visitor, and then it displays a thank you page. It also checks if user has left a relevant field, here, email, blank.
There are basically two email handling objects used by servers supporting ASP capability, viz., CDONTS and SMTP. We'll see how both work.
First, let us make an HTML page that contains our form (note that every HTML tag is preceded by a dot so that some of email clients don't throw up a tantrum - you'll have to remove them before implementing code):
"form.html"
. .
.This is a test page to run an ASP script that handles form input. .
. And now we write ASP file that handles required script to process above form. Remarks are inserted using ' .
"emailform.asp"
.<% @Language = VBScript %> .<% Option Explicit %> .<% Response.Buffer = True %>
' You'll need above command in case you want to show a "Thank you" page, as you'll need to "re-direct" to "thankyou.html".