If this tutorial is not what you were looking for, you still have any questions, suggestions or concerns - feel free to let us know. Please help us to serve you better!

Your Name

Your Email

Your Message (required)

captcha

How to create an ASP contact form in HTML

Let’s learn it at an example. Let’s say one of your pages has a code as follows:

<form id="form" action="" enctype="multipart/form-data">
<div class="inp_h">
<input class="inp_2" type="text"  name="name" value="Name:"  onfocus="this.value=''" />
</div>
<div class="inp_h">
<input class="inp_2" type="text"  name="mail" value="E-mail:"  onfocus="this.value=''" />
</div>
<div><textarea class="inp_3" rows="30" cols="40"  onfocus="this.value=''">Message:</textarea></div>
<div style="padding:12px 0 0 0;">
<a href="#" onclick="document.getElementById('form').reset()">
	<img src="images/clear.jpg" style="border:0px none;" alt="" />
</a>
<img src="images/spacer.gif" alt="" width="6" height="1" />
<a href="#" onclick="document.getElementById('form').submit()">
	<img src="images/send.jpg" style="border:0px none;" alt="" />
</a><br />
</div>
</form>

The layout of the contact form can look like this:

On your server you should have a script that will actually generate and send e-mails to a certain e-mail address. A sample of this contact.asp script you can download here. The ASP script is supported on the most of Windows-based hosting servers.

Our html form has two tags: opening <form> and closing </form>. For the form to pass data to our contact.asp we need to specify five attributes within this tag:

<form id="form" method="post"  target="_blank" action="contact.asp" name="form" >

- “Id” attribute is a standard for all forms;
- “Method” attribute specifies what method is using for sending contact form letters;
- “Target” attribute specifies how the message which is telling us that letter was sent will be appear;
- “Action” attribute is telling us that we are using ” contact.asp” file as a script for sending letters;
- “Name” attribute is a value which is used in contact.asp file.

The form we are working with has two text input fields and one text area. The original contact form already has two of them: name=”name”, name=”mail”, you will also need to set the third name value into the message text area – name=”message”. The resulting <form> script should look like this:

<form id="form" method="post"  target="_blank" action="contact.asp" name="form" >
<div class="inp_h">
<input class="inp_2" type="text"  name="name" value="Name:"  onfocus="this.value=''" />
</div>
<div class="inp_h">
<input class="inp_2" type="text"  name="mail" value="E-mail:"  onfocus="this.value=''" />
</div>
<div><textarea class="inp_3" rows="30" cols="40" name="message" onfocus="this.value=''">Message:</textarea></div>
<div style="padding:12px 0 0 0;">
<a href="#" onclick="document.getElementById('form').reset()">
	<img src="images/clear.jpg" style="border:0px none;" alt="" />
</a><img src="images/spacer.gif" alt="" width="6" height="1" />
<a href="#" onclick="document.getElementById('form').submit()">
	<img src="images/send.jpg" style="border:0px none;" alt="" />
</a><br />                                                                
</div>
</form>

where you can see the code for the Reset button:

<a href="#" onclick="document.getElementById('form').reset()"><img src="images/clear.jpg" style="border:0px none;" alt="" /></a>

And the code for Submit or Send button:

<a href="#" onclick="document.getElementById('form').submit()"><img src="images/send.jpg" style="border:0px none;" alt="" /></a>

Now lets take one of the templates which doesn’t have the CSS structure and uses tables. Here is the default code from the contact form:

<form action="" id="form1" style="margin:0; padding:0 ">
<table style="height:213px">
<tr>
<td style="width:239px; padding-left:29px">
<input type="text" class="input3" value="  Your Name:" /><br />
<input type="text" class="input3" value="  Your Fax:" /><br />
<input type="text" class="input3" value="  Your Phone:" /><br />
<input type="text" class="input3" value="  Your E-mail:" />
</td>
<td style="width:259px">
<textarea name="textarea" style="margin:0 0 11px 0px" cols="35" rows="35">&nbsp; Your Message:</textarea><br />
<a href="#" onclick="document.getElementById('form1').reset()" class="more_2" style="margin:0 16px 0 107px">clear</a>
<a href="#" onclick="document.getElementById('form1').reset()" class="more_2">send</a><br />
</td>
</tr>
</table>
</form>

You have to insert the same values as in example above, so let’s see how the result code should look like:

<form id="form" method="post"  target="_blank" action="contact.asp" name="form">
<table style="height:213px">
<tr>
<td style="width:239px; padding-left:29px">
<input type="text" name="name" class="input3" value="  Your Name:" /><br />
<input type="text" name="fax" class="input3" value="  Your Fax:" /><br />
<input type="text" name="phone" class="input3" value="  Your Phone:" /><br />
<input type="text" name="mail" class="input3" value="  Your E-mail:" />
</td>
<td style="width:259px">
<textarea name="message" style="margin:0 0 11px 0px" cols="35" rows="35">&nbsp; Your Message:</textarea><br />
<a href="#" onclick="document.getElementById('form').reset()" class="more_2" style="margin:0 16px 0 107px">clear</a>
<a href="#" onclick="document.getElementById('form').reset()" class="more_2">send</a><br />
</td>
</tr>
</table>
</form>

Now let’s take a look at the contact.asp file, what do we need to change here. Open it with your php editor and find the following lines:

‘—-Settings———–
subj = “Contact form from your site” – (here you can change heading message which you will receive in the letter from guest)
mail_from = “[email protected]” – (here you need to put your website mail address )
mail_to = “[email protected]” – (here you need to put your own email address)
smtp_server = “localhost” – (here you need to put SMTP server name of your server )
smtp_port = 25 – (here you need to put SMTP port of your server)

If you don’t know these settings, you need to contact your hosting provider for the details.

How to create an ASP contact form in HTML, 2.3 out of 5 based on 5 ratings
  • http://www.xplorarticles.com/recreation-sports/tips-to-get-cheap-ncaa-tournament-tickets.html Ambrose Hampton

    By visiting your webpage, the first impression for me is strong. I can’t imagine when and why you share this great topic but don’t spread it with social bookmarking. This information can be published as reference in online journal, or even in press release site. An early improvement in your site is great, can give us more time in your website. Would you mind if I capture several screenshot as my collection, because I’ve joined several researches? General purpose for me is to tell you about this discussion. My critical question for us is the resource that you have used to manage this site. In order to make great discussion, you are great because you post new topic in several areas. But, I suggest in giving personal opinion, please refer to big or authority sites, I am sure you will be fine in giving past or future experiences. In my environment, I am sure your capability to enrich people can be strong advantage for your future.

  • http://www.herbalteablends.com Amy Korkiakoski

    I tried to click on the link to download contact_asp.zip and the page came up with an error. Please let me know how I can download this file.

    Thank you

    • Chris Diaz

      Sorry for the inconveniences. The download link is working fine now.

  • http://www.thearticledepot.com/Art/220525/247/The-Royal-Wedding-of-Prince-William-and-Kate-Middleton.html royal wedding

    The catchy blog with the interesting posts. You give the nice information that many people don’t know before. most of your contents are make me have more knowledge. it is very different. I was impressed with your blog. Never be bored to visit your blog again. Have the nice day.Keep enjoyed your blogging.

  • http://www.skinmoisturizers.info Skin Moisturizers

    Thanks for the great post on your blog, it really gives me an insight on this topic.

  • Kitchen Rugs

    Your blog is one of a kind, i love the way you organize the topics.

  • http://www.compactfluorescentbulb.info compact fluorescent lamp bases

    I always visit new blog everyday and i found your blog.

  • http://www.candypaint.org candy apple red paint

    Hi, do you have a facebook fan page for your blog?*-..-

  • http://www.amc-hln.com Tyler

    Thank you, thank you, thank you! I was looking around what seems like ages for an ASP contact form that I could target for my new company website I built.

    This works like a charm! The tut would be very helpful too, but I already built the form container.

  • http://www.million-euros-homepage.biz/choose-smart-stop-loss-in-forex/ Make Money From Forex

    I like this site so much, saved to bookmarks .

  • http://szkolenia-forex.blogspot.com/ szkolenia forex

    Thanks for everything, appreciate this Blog you have here.

  • http://www.pcsolottoresult.org/ Grand Lotto Result 6/55

    Wow, you seem to be very knowledgable about this kind of topics

  • Alex Ross

    Please check the link once again.

  • Nagesh Reddy

    Great…I am working first time on the windows server….Thank you very much

  • Alex Ross

    Hi, as was stated previously, contact form will not work locally. Also, make sure you live server support ASP.