Created
June 27, 2015 10:24
-
-
Save sealucky7/3071eb43566ac03f8c87 to your computer and use it in GitHub Desktop.
Send mail all form
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
<form method="GET" action="hear name files, where code form"> | |
<div class="form min-form" data-name="Отправить"> | |
<input type="hidden" name="cat" value="Отправить"> | |
<input type="hidden" name="utm_source" class="source" value="<?php echo isset($_GET['utm_source']) ? $_GET['utm_source'] : '' ;?>" /> | |
<input type="hidden" name="utm_term" class="term" value="<?php echo isset($_GET['utm_term']) ? $_GET['utm_term'] : '' ;?>" /> | |
<input type="hidden" name="utm_medium" value="<?php echo $_GET['utm_medium'];?>"> | |
<input type="hidden" name="utm_campaign" value="<?php echo $_GET['utm_campaign'];?>"> | |
<input type="hidden" name="utm_content" value="<?php echo $_GET['utm_content'];?>"> | |
<input class="tel" name="tel" type="text" placeholder="Ваш телефон" data-name="Телефон"> | |
<div class="button_conteiner"> | |
<button class="button submit">Отправить</button> | |
</div> | |
</div> | |
</form> | |
<!-- Здесь код для обработки и отправки формы на мыло --> | |
<? | |
// принимаем данные | |
$cname = trim($_GET['cat']); | |
$cphone = trim($_GET['tel']); | |
$cemail = trim($_GET['email']); | |
$ccat = trim($_GET['cat']); | |
$utm = trim($_GET['utm']); | |
$campaing = trim($_GET['campaing']); | |
$utmsource = trim($_GET['utm_sourse']); | |
$utmcampaign = trim($_GET['utm_campaign']); | |
$utmmedium = trim($_GET['utm_medium']); | |
$utmcontent = trim($_GET['utm_content']); | |
$utmterm = trim($_GET['utm_term']); | |
// а вот тут эти данные надо куда-то записать…; | |
if (isset($_GET['tel'])) {$cphone = $_GET['tel'];} | |
if (isset($_GET['cat'])) {$cname = $_GET['cat'];} | |
if (isset($_GET['email'])) {$cemail = $_GET['email'];} | |
if (isset($_GET['cat'])) {$ccat = $_GET['cat'];} | |
if (isset($_GET['utm'])) {$cutm = $_GET['utm'];} | |
if (isset($_GET['campaing'])) {$ccampaing = $_GET['campaing'];} | |
if (isset($_GET['utm_source'])) {$utmsource = $_GET['utm_source'];} else {$utmsource = ' ';} | |
if (isset($_GET['utm_campaign'])) {$utmcampaign = $_GET['utm_campaign'];} else {$utmcampaign = ' ';} | |
if (isset($_GET['utm_medium'])) {$utmmedium = $_GET['utm_medium'];} else {$utmmedium = ' ';} | |
if (isset($_GET['utm_content'])) {$utmcontent = $_GET['utm_content'];} else {$utmcontent = ' ';} | |
if (isset($_GET['utm_term'])) {$utmterm = $_GET['utm_term'];} else {$utmterm = ' ';} | |
$to = 'name@mail'; | |
// $from - от кого | |
$title='Клиент с сайта "name site"'; | |
$from='name site'; | |
$mail_header.= 'MIME-Version: 1.0\r\n'; | |
$mail_header = 'Content-type: text/html; charset="utf-8"\r\n'; | |
$mail_header.= 'From: Zakaz'.$from.'>\r\n'; | |
$mail_header.= 'X-Mailer: PHP v'.phpversion(); | |
$format_st = '<html><head><meta charset="utf-8"/></head><body><p align=left>'; | |
$format_fin = "</p></body></html>"; | |
// функция, которая отправляет наше письмо. | |
mail($to, $title, $format_st.'<b> Описание заявки:</b> '.$ccat.'<br><b>Телефон:</b> '.$cphone.' '.$format_fin, $mail_header, '-f'.$from); $cemail=$cphone.'@email.ru'; | |
$web = 'Utm: '.$cutm.' Campaing: '.$ccampaing; | |
ini_set('short_open_tag', 'On'); | |
error_reporting(-1); | |
header('Content-Type: text/html; charset=utf-8'); | |
$root = DIRECTORY_SEPARATOR; | |
header('Location:../имя файла на стр благодарности'); | |
?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment