Last active
July 10, 2017 15:50
-
-
Save vgordeew/292ffd30a062e93c915c64abab202efd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// HTML | |
<div class="main-form"> | |
<h2>Форма обратной связи</h2> | |
<h5>Будем рады</h5> | |
<form action="send.php" method="POST"> | |
<input type="hidden" name="form" value="Форма обратной связи"> | |
<input type="text" name="name" minlength="2" maxlength="30" placeholder="Имя" required="required"> | |
<input type="tel" id="phone1" name="phone" placeholder="Телефон" required="required"> | |
<input type="email" minlength="5" placeholder="E-mail" required="required"> | |
<button type="submit" name="email" class="submit">Отправить</button> | |
</form> | |
</div> | |
// CSS | |
.main-form | |
background-color: $backgroundcolor | |
padding-top: 100px | |
h5 | |
font-size: 18px | |
line-height: 26px | |
text-align: center | |
font-weight: normal | |
color: $footer-color | |
h2 | |
padding-top: 20px | |
font-weight: bold | |
text-align: center | |
font-size: 25px | |
line-height: 35px | |
letter-spacing: 3px | |
text-transform: uppercase | |
form | |
padding: 50px | |
input | |
display: block | |
border-color: transparent | |
border: none | |
border-bottom: 1px solid $silver-color | |
width: 100% | |
height: 60px | |
margin-top: 5px | |
background-color: $backgroundcolor | |
opacity: 0.6 | |
transition: all 0.4s ease 0s | |
input:hover | |
opacity: 0.9 | |
// PHP | |
<?php | |
//Принимаем постовые данные | |
$name=$_POST['name']; | |
$phone=$_POST['phone']; | |
//Тут указываем на какой ящик посылать письмо | |
$to = "[email protected]"; | |
//Далее идет тема и само сообщение | |
// Тема письма | |
$subject = "Заявка с сайта"; | |
// Сообщение письма | |
$message = " | |
Имя пользователя: ".htmlspecialchars($name)."<br /> | |
Телефон: <a href='tel:$phone'>".htmlspecialchars($phone)."</a>"; | |
// Отправляем письмо при помощи функции mail(); | |
$headers = "From: stastroi.ru <[email protected]>\r\nContent-type: text/html; charset=UTF-8 \r\n"; | |
mail ($to, $subject, $message, $headers); | |
// Перенаправляем человека на страницу благодарности и завершаем скрипт | |
header('Location: thanks.html'); | |
exit(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment