{"id":1708,"date":"2010-11-15T10:24:58","date_gmt":"2010-11-15T10:24:58","guid":{"rendered":"http:\/\/mts-help.nick.php.dev\/after_sale_support\/working_with_html\/Advanced\/article15.html"},"modified":"2020-01-31T05:01:42","modified_gmt":"2020-01-31T10:01:42","slug":"how-create-asp-contact-form-html","status":"publish","type":"post","link":"https:\/\/www.templatemonster.com\/help\/how-create-asp-contact-form-html.html","title":{"rendered":"How to create an ASP contact form in HTML"},"content":{"rendered":"Let&#8217;s learn it at an example. Let&#8217;s say one of your pages has a code as follows:\r\n<pre class=\"brush:html\">&lt;form id=\"form\" action=\"\" enctype=\"multipart\/form-data\"&gt;\r\n&lt;div class=\"inp_h\"&gt;\r\n&lt;input class=\"inp_2\" type=\"text\"  name=\"name\" value=\"Name:\"  onfocus=\"this.value=''\" \/&gt;\r\n&lt;\/div&gt;\r\n&lt;div class=\"inp_h\"&gt;\r\n&lt;input class=\"inp_2\" type=\"text\"  name=\"mail\" value=\"E-mail:\"  onfocus=\"this.value=''\" \/&gt;\r\n&lt;\/div&gt;\r\n&lt;div&gt;&lt;textarea class=\"inp_3\" rows=\"30\" cols=\"40\"  onfocus=\"this.value=''\"&gt;Message:&lt;\/textarea&gt;&lt;\/div&gt;\r\n&lt;div style=\"padding:12px 0 0 0;\"&gt;\r\n&lt;a href=\"#\" onclick=\"document.getElementById('form').reset()\"&gt;\r\n\t&lt;img src=\"images\/clear.jpg\" style=\"border:0px none;\" alt=\"\" \/&gt;\r\n&lt;\/a&gt;\r\n&lt;img src=\"images\/spacer.gif\" alt=\"\" width=\"6\" height=\"1\" \/&gt;\r\n&lt;a href=\"#\" onclick=\"document.getElementById('form').submit()\"&gt;\r\n\t&lt;img src=\"images\/send.jpg\" style=\"border:0px none;\" alt=\"\" \/&gt;\r\n&lt;\/a&gt;&lt;br \/&gt;\r\n&lt;\/div&gt;\r\n&lt;\/form&gt;<\/pre>\r\nThe layout of the contact form can look like this:\r\n<div style=\"text-align: left;\">\r\n<div style=\"text-align: left;\">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 <span style=\"font-weight: bold;\">contact.asp<\/span> script you can download <a href=\"\/help\/files\/Html\/contact_asp.zip\">here<\/a>. The ASP script is supported on the most of Windows-based hosting servers.\r\n\r\nOur html form has two tags: opening <span style=\"font-weight: bold;\">&lt;form&gt;<\/span> and closing <span style=\"font-weight: bold;\">&lt;\/form&gt;<\/span>. For the form to pass data to our <span style=\"font-weight: bold;\">contact.asp<\/span> we need to specify five attributes within this tag:\r\n<pre class=\"brush:html\">&lt;form id=\"form\" method=\"post\"  target=\"_blank\" action=\"contact.asp\" name=\"form\" &gt;<\/pre>\r\n&#8211; <span style=\"font-weight: bold;\">&#8220;Id&#8221;<\/span> attribute is a standard for all forms;\r\n<span style=\"font-weight: bold;\">&#8211; &#8220;Method&#8221;<\/span> attribute specifies what method is using for sending contact form letters;\r\n<span style=\"font-weight: bold;\">&#8211; &#8220;Target&#8221;<\/span> attribute specifies how the message which is telling us that letter was sent will be appear;\r\n<span style=\"font-weight: bold;\">&#8211; &#8220;Action&#8221;<\/span> attribute is telling us that we are using &#8221; contact.asp&#8221; file as a script for sending letters;\r\n<span style=\"font-weight: bold;\">&#8211; &#8220;Name&#8221;<\/span> attribute is a value which is used in contact.asp file.\r\n\r\nThe form we are working with has two text input fields and one text area. The original contact form already has two of them: <span style=\"font-weight: bold;\">name=&#8221;name&#8221;<\/span>, <span style=\"font-weight: bold;\">name=&#8221;mail&#8221;<\/span>, you will also need to set the third name value into the message text area \u2013 <span style=\"font-weight: bold;\">name=&#8221;message&#8221;<\/span>. The resulting <span style=\"font-weight: bold;\">&lt;form&gt;<\/span> script should look like this:\r\n<pre class=\"brush:html\">&lt;form id=\"form\" method=\"post\"  target=\"_blank\" action=\"contact.asp\" name=\"form\" &gt;\r\n&lt;div class=\"inp_h\"&gt;\r\n&lt;input class=\"inp_2\" type=\"text\"  name=\"name\" value=\"Name:\"  onfocus=\"this.value=''\" \/&gt;\r\n&lt;\/div&gt;\r\n&lt;div class=\"inp_h\"&gt;\r\n&lt;input class=\"inp_2\" type=\"text\"  name=\"mail\" value=\"E-mail:\"  onfocus=\"this.value=''\" \/&gt;\r\n&lt;\/div&gt;\r\n&lt;div&gt;&lt;textarea class=\"inp_3\" rows=\"30\" cols=\"40\" name=\"message\" onfocus=\"this.value=''\"&gt;Message:&lt;\/textarea&gt;&lt;\/div&gt;\r\n&lt;div style=\"padding:12px 0 0 0;\"&gt;\r\n&lt;a href=\"#\" onclick=\"document.getElementById('form').reset()\"&gt;\r\n\t&lt;img src=\"images\/clear.jpg\" style=\"border:0px none;\" alt=\"\" \/&gt;\r\n&lt;\/a&gt;&lt;img src=\"images\/spacer.gif\" alt=\"\" width=\"6\" height=\"1\" \/&gt;\r\n&lt;a href=\"#\" onclick=\"document.getElementById('form').submit()\"&gt;\r\n\t&lt;img src=\"images\/send.jpg\" style=\"border:0px none;\" alt=\"\" \/&gt;\r\n&lt;\/a&gt;&lt;br \/&gt;                                                                \r\n&lt;\/div&gt;\r\n&lt;\/form&gt;<\/pre>\r\nwhere you can see the code for the <span style=\"font-weight: bold;\">Reset<\/span> button:\r\n<pre class=\"brush:html\">&lt;a href=\"#\" onclick=\"document.getElementById('form').reset()\"&gt;&lt;img src=\"images\/clear.jpg\" style=\"border:0px none;\" alt=\"\" \/&gt;&lt;\/a&gt;<\/pre>\r\nAnd the code for <span style=\"font-weight: bold;\">Submit<\/span> or <span style=\"font-weight: bold;\">Send<\/span> button:\r\n<pre class=\"brush:html\">&lt;a href=\"#\" onclick=\"document.getElementById('form').submit()\"&gt;&lt;img src=\"images\/send.jpg\" style=\"border:0px none;\" alt=\"\" \/&gt;&lt;\/a&gt;<\/pre>\r\nNow lets take one of the templates which doesn&#8217;t have the <span style=\"font-weight: bold;\">CSS structure<\/span> and uses tables. Here is the default code from the contact form:\r\n<pre class=\"brush:html\">&lt;form action=\"\" id=\"form1\" style=\"margin:0; padding:0 \"&gt;\r\n&lt;table style=\"height:213px\"&gt;\r\n&lt;tr&gt;\r\n&lt;td style=\"width:239px; padding-left:29px\"&gt;\r\n&lt;input type=\"text\" class=\"input3\" value=\"  Your Name:\" \/&gt;&lt;br \/&gt;\r\n&lt;input type=\"text\" class=\"input3\" value=\"  Your Fax:\" \/&gt;&lt;br \/&gt;\r\n&lt;input type=\"text\" class=\"input3\" value=\"  Your Phone:\" \/&gt;&lt;br \/&gt;\r\n&lt;input type=\"text\" class=\"input3\" value=\"  Your E-mail:\" \/&gt;\r\n&lt;\/td&gt;\r\n&lt;td style=\"width:259px\"&gt;\r\n&lt;textarea name=\"textarea\" style=\"margin:0 0 11px 0px\" cols=\"35\" rows=\"35\"&gt;&amp;nbsp; Your Message:&lt;\/textarea&gt;&lt;br \/&gt;\r\n&lt;a href=\"#\" onclick=\"document.getElementById('form1').reset()\" class=\"more_2\" style=\"margin:0 16px 0 107px\"&gt;clear&lt;\/a&gt;\r\n&lt;a href=\"#\" onclick=\"document.getElementById('form1').reset()\" class=\"more_2\"&gt;send&lt;\/a&gt;&lt;br \/&gt;\r\n&lt;\/td&gt;\r\n&lt;\/tr&gt;\r\n&lt;\/table&gt;\r\n&lt;\/form&gt;<\/pre>\r\nYou have to insert the same values as in example above, so let&#8217;s see how the result code should look like:\r\n<pre class=\"brush:html\">&lt;form id=\"form\" method=\"post\"  target=\"_blank\" action=\"contact.asp\" name=\"form\"&gt;\r\n&lt;table style=\"height:213px\"&gt;\r\n&lt;tr&gt;\r\n&lt;td style=\"width:239px; padding-left:29px\"&gt;\r\n&lt;input type=\"text\" name=\"name\" class=\"input3\" value=\"  Your Name:\" \/&gt;&lt;br \/&gt;\r\n&lt;input type=\"text\" name=\"fax\" class=\"input3\" value=\"  Your Fax:\" \/&gt;&lt;br \/&gt;\r\n&lt;input type=\"text\" name=\"phone\" class=\"input3\" value=\"  Your Phone:\" \/&gt;&lt;br \/&gt;\r\n&lt;input type=\"text\" name=\"mail\" class=\"input3\" value=\"  Your E-mail:\" \/&gt;\r\n&lt;\/td&gt;\r\n&lt;td style=\"width:259px\"&gt;\r\n&lt;textarea name=\"message\" style=\"margin:0 0 11px 0px\" cols=\"35\" rows=\"35\"&gt;&amp;nbsp; Your Message:&lt;\/textarea&gt;&lt;br \/&gt;\r\n&lt;a href=\"#\" onclick=\"document.getElementById('form').reset()\" class=\"more_2\" style=\"margin:0 16px 0 107px\"&gt;clear&lt;\/a&gt;\r\n&lt;a href=\"#\" onclick=\"document.getElementById('form').reset()\" class=\"more_2\"&gt;send&lt;\/a&gt;&lt;br \/&gt;\r\n&lt;\/td&gt;\r\n&lt;\/tr&gt;\r\n&lt;\/table&gt;\r\n&lt;\/form&gt;<\/pre>\r\nNow let&#8217;s take a look at the <span style=\"font-weight: bold;\">contact.asp<\/span> file, what do we need to change here. Open it with your php editor and find the following lines:\r\n\r\n&#8216;&#8212;-Settings&#8212;&#8212;&#8212;&#8211;\r\nsubj = &#8220;Contact form from your site&#8221;      &#8211; (here you can change heading message which you will receive in the letter from guest)\r\nmail_from = &#8220;admin@tsie.loc&#8221;                &#8211; (here you need to put your website mail address )\r\nmail_to = &#8220;andy@template-help.com&#8221;  &#8211;  (here you need to put your own email address)\r\nsmtp_server = &#8220;localhost&#8221;                       &#8211; (here you need to put SMTP server name of your server )\r\nsmtp_port = 25                                          &#8211; (here you need to put SMTP port of your server)\r\n\r\nIf you don&#8217;t know these settings, you need to contact your hosting provider for the details.\r\n\r\n<\/div>\r\n<\/div>","protected":false},"excerpt":{"rendered":"<p>\u0412 \u044d\u0442\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0432\u044b \u0443\u0437\u043d\u0430\u0435\u0442\u0435, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043d\u0443\u044e \u0444\u043e\u0440\u043c\u0443 ASP \u0432 HTML<\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[253],"tags":[497,509,2411],"_links":{"self":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/1708"}],"collection":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/comments?post=1708"}],"version-history":[{"count":1,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/1708\/revisions"}],"predecessor-version":[{"id":86102,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/1708\/revisions\/86102"}],"wp:attachment":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media?parent=1708"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/categories?post=1708"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/tags?post=1708"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}