Tuesday, July 8, 2008

Sending a HTML form values to email inbox

Getting the html form data in the email inbox will be a very convenient way to collect user responses very quickly. Except, when you have hundreds of responses per day! Here are the methods you have to get the html form data in your email inbox.

One quick and simple method is to use the 'mailto:you@yourdomain.com' in the 'action' field of the form. This method is very simple; but has many drawbacks.

Getting the html form data in the email inbox will be a very convenient way to collect user responses very quickly. Except, when you have hundreds of responses per day! Here are the methods you have to get the html form data in your email inbox.

One quick and simple method is to use the 'mailto:you@yourdomain.com' in the 'action' field of the form. This method is very simple; but has many drawbacks.

Using a Formmail Script

A formmail script is a server side script that gathers the data submitted in the form and mails it to a given email address.

There are many formmail scripts available.

The following section describes how to use a form mail script
Suppose the URL to the formmail script provided to you is http//someserver/cgi-bin/formmail.pl

give this URL in the ACTION attribute of your FORM tag
<FORM ACTION="http//someserver/cgi-bin/formmail.pl" METHOD="POST">
.....Your input elements.....
</FORM>

# Now you can give whatever input elements you want within the form tags.

# There are some information that you should provide to the CGI program (like the email address to which the form-data should be sent)
provide these data as hidden fields in the form
(using <INPUT TYPE="hidden" ......>)

# Insert the Submit button.

Over! you are ready with your form.

Example:
The geocities.com form-mail program URL is
http://us.geocities.yahoo.com/forms

Let us complete the form we were using in our examples using this
form-mail script as the form handler.

There are some parameters required by this CGI program
Name Description
login your yahoo login id
subject subject line of the mail sent to you by the formmail program
next_url the URL of the page to be displayed after submitting this page successfully

We will have to give these parameters as hidden fields.

<FORM ACTION="http://us.geocities.yahoo.com/forms" METHOD="POST">

Name: <INPUT TYPE="text" NAME="Name" VALUE="" SIZE="25" MAXLENGTH="50"> <BR>

Email: <INPUT TYPE="text" NAME="Email" VALUE="" SIZE="25" MAXLENGTH="50"><BR>

<INPUT TYPE="CHECKBOX" NAME="subscribe" CHECKED> Subscribe me to the News letter <BR>

Format of the Email:<BR>
<INPUT TYPE="radio" NAME="format" VALUE="html" CHECKED> HTML<BR>
<INPUT TYPE="radio" NAME="format" VALUE="text"> Plain Text<BR>

Type of subscription you want:<BR>
<SELECT NAME="type">
<OPTION VALUE="standard"> Standard - FREE
<OPTION VALUE="prof" > Professional - Paid
</SELECT> <BR>

Comments to the editor:<BR>
<TEXTAREA NAME="comments" ROWS="7" COLS="30"></TEXTAREA>

<input type="hidden" name="login" value="your_yahoo_id_please">

<input type="hidden" name="subject" value="Posted From My Form">

<input type="hidden" name="next_url" value="http://myserver/thankyou.htm">

<BR>
<INPUT TYPE="SUBMIT" NAME="submit" VALUE="Sign Me Up!">
</FORM>

When this form is submitted, the form-mail script sends the information submitted, to the email address corresponding to the id given in the hidden field 'login'. The mail will contain the field names and corresponding values as submitted by the user like this:
Name: yourVisitorName
Email: thename@server.com
subscribe:on
format:text
type:standard
comments: your site rocks!

0 comments:

Your Ad Here
Reader's kind attention....The articles contained in this blog can be taken from other web sites, as the main intention of this blog is to let people get all sides of the web technologies under the single roof..so if any one finds duplication or copy of your articles in this blog and if you want that to be removed from this ..kindly inform me and i will remove it...alternatively if you want me to link back to your site with the article...that can also be done...

Thanks,
Webnology Blog Administrator
 

blogger templates