Skip to content

Instantly share code, notes, and snippets.

@yaroslavKas
Created May 19, 2016 08:19
Show Gist options
  • Save yaroslavKas/904497b192b34741b36cdf8eca8804bc to your computer and use it in GitHub Desktop.
Save yaroslavKas/904497b192b34741b36cdf8eca8804bc to your computer and use it in GitHub Desktop.
Отправка формы
<form id="form2" method="post" class="headerform">
<div class="form-group">
<label>
<input type="text" class="form-control phone" name="phone" id="one_click" placeholder="+7 (___) ___-__-__" >
<input type="hidden" class="name" name="one_click" value="бляя">
</label>
</div>
<button id="submitForm" class="submit" type="submit">Заказать</button>
</form>
//надо вставить <input type="hidden" class="name" name="one_click" value="бляя">
<?php
$recepient = "spravkivgai@yandex.ru, bibill@mail.ru";
$sitename = "spravkivgai.org";
if (isset($_POST["one_click"])){
$phone = trim($_POST["phone"]);
$message = "Заявка в один клик\n\nТелефон: $phone \n";
}
if (isset($_POST["write_us"])){
$name = trim($_POST["name"]);
$phone = trim($_POST["phone"]);
$mail = trim($_POST["email"]);
$text = trim($_POST["text"]);
$text = trim($_POST["menu-797"]);
$message = "Имя: $name \nТелефон: $phone \nEmail: $mail \nКомментарий: $text";
}
$pagetitle = "Новая заявка с сайта \"$sitename\"";
mail($recepient, $pagetitle, $message, "Content-type: text/plain; charset=\"utf-8\"\n From: $recepient");
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment