- Веб-Шаблоны
- Шаблон интернет-магазина
- Шаблоны для CMS
- Facebook шаблоны
- Конструктор сайтов
Как создать контактную форму ASP в HTML?
Ноябрь 15, 2010
Давайте узнаем это на примере. Скажем одна из ваших страниц имеет такой код:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | < 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 > |
Макет контактной формы может выглядеть так:
Ваш сервре должен иметь скрипт, который будет генерировать и отправлять сообщения на определенный адрес электронной почты. Скачать образец contact.asp вы можете здесь .
Наша форма HTML две метки: открытие и закрытие тэги
Где, вы можете увидеть код для кнопки сброса:
1 | < a href = "#" onclick = "document.getElementById('form').reset()" >< img src = "images/clear.jpg" style = "border:0px none;" alt = "" ></ a > |
И код для кнопок Подтвердить и Отправить:
1 | < a href = "#" onclick = "document.getElementById('form').submit()" >< img src = "images/send.jpg" style = "border:0px none;" alt = "" ></ a > |
Теперь давайте возьмем один из шаблонов, которые не использует CSS таблицы. Здесь по умолчанию код контактной формы будет таким:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | < form action = "" id = "form1" style = "margin:0; padding:0 " >< br > < table style = "height:213px" > < tbody >< 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" > 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 > </ tbody ></ table > </ form > |
Вы должны вставить те же значения, как в приведенном в примере выше, в результате код должен выглядеть так:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | < form id = "form" method = "post" target = "_blank" action = "contact.asp" name = "form" > < table style = "height:213px" > < tbody >< 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:" >< br > </ td > < td style = "width:259px" > < textarea name = "message" style = "margin:0 0 11px 0px" cols = "35" rows = "35" > 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 > </ tbody ></ table > </ form > |
Теперь давайте взглянем на файл contact.asp, что мы должны изменить здесь. Откройте его в PHP редакторе и найдите следующие строки:
‘—- Настройки ————
Subj = «Contact form from your site» — (здесь вы можете изменить заголовок сообщения, которые вы получите в письме от гостя)
mail_from = «admin@tsie.loc» — (здесь нужно вставить адрес веб-почты)
mail_to = «andy@template-help.com» — (здесь нужно вставить собственный адрес электронной почты)
smtp_server = » localhost » — (здесь нужно вставить имя SMTP сервера)
smtp_port = 25 — (здесь нужно вставить порт вашего SMTP сервера)