Faced such a problem, namely:
on the site http://sushki.com.ua/ there is a form for ordering goods. 
Filling in all the fields and selecting the checkbox "Payment in cash" and clicking "Go to payment", an order message arrives in the mail and everything is good.
But if you select "Payment online" and clicking "Go to payment", you go to Liqpay and the message does not arrive in the mail.
Help solve this problem.
Code: ok.php
<?php require_once 'dbconfig.php'; $dbh = new PDO("mysql:host=$host;dbname=$dbname", $username, $password); $micro = sprintf("%06d",(microtime(true) - floor(microtime(true))) * 1000000); $number = date("YmdHis"); $order = $micro; //Будем формировать номер ордера таким образом... // echo "connect"; /* $title = $POST['title']; $model = $POST['model']; $price = $POST['price']; $name = $POST['name']; $phone = $POST['phone']; $place = $POST['place']; */ $cdate = date("Ymd"); if (empty($_POST['online'])){ $stmt = $dbh->prepare("INSERT INTO users(date,title,model,price,name,phone,place,uid) VALUES(:date,:title,:model,:price,:name,:phone,:place,:uid)"); $order_id = $number; $stmt->bindParam(':date', $cdate); $stmt->bindParam(':title', $title); $stmt->bindParam(':model', $model); $stmt->bindParam(':price', $price); $stmt->bindParam(':name', $name); $stmt->bindParam(':phone', $phone); $stmt->bindParam(':place', $place); $stmt->bindParam(':uid', $uid); $model = $_POST['model']; $price = $_POST['price']; $name = $_POST['name']; $phone = $_POST['phone']; $place = $_POST['place']; $uid ="заказал обратный звонок"; // вставим одну строку //$name = 'one'; //$value = 1; $stmt->execute(); unset($_POST['price']); $to = 'info@sushki.com.ua'; $subject ='Заявка с сайта sushki.com.ua'; $headers = "From: SUSHKI.COM.UA <info@sushki.com.ua>\r\nContent-type:text/plain;charset=utf-8"; $message = ""; $phone = $_POST["phone"]; $name = ! empty($_POST["name"]) ? $_POST["name"] : 'Не указано'; $email = ! empty($_POST["email"]) ? $_POST["email"] : 'Не указано'; $theme = ! empty($_POST["title"])? $_POST["title"] : 'Без темы'; $message = "Форма: ".$theme ."\nИмя: ".$name."\nТелефон: ".$phone."\nEmail: ".$email."\n\n"; if (! empty($_COOKIE['utm_source'])) { $message .= "\nutm_source: ".$_COOKIE['utm_source']; }; if (! empty($_COOKIE['utm_campaign'])) { $message .= "\nutm_campaign: ".$_COOKIE['utm_campaign']; }; if (! empty($_COOKIE['utm_medium'])) { $message .= "\nutm_medium: ".$_COOKIE['utm_medium']; }; if (! empty($_COOKIE['utm_term'])) { $message .= "\nutm_term: ".$_COOKIE['utm_term']; }; if (! empty($_COOKIE['utm_content'])) { $message .= "\nutm_content: ".$_COOKIE['utm_content']; }; mail($to, $subject, $message, $headers); $_POST['phone'] = str_replace('+', '%2B', $_POST['phone']); echo <<<EOT <style> .text { text-align: center; text-shadow:1px 1px 0 rgba(252,255,253,1);font-weight:normal;color:#DB1D3C;letter-spacing:1pt;word-spacing:2pt;font-size:33px;text-align:center;font-family:impact, sans-serif;line-height:1; margin: auto; margin-top:10%; width: 800px; } </style> <div class="text"> <p style="text-shadow:1px 1px 0 rgba(252,255,253,1);font-weight:normal;color:#DB1D3C;letter-spacing:1pt;word-spacing:2pt;font-size:33px;text-align:center;font-family:impact, sans-serif;line-height:1;">Спасибо! </br>В течении нескольких минут Вам позвонит наш оператор!</br> </br><a href="http://sushki.com.ua/">На главную</a></p> </div> EOT; //file_get_contents("http://smsc.ru/sys/send.php?login=lp5lp5&psw=aht53ndgd64&phones=+380661478469s&charset=utf-8&mes=Имя:%20" . $_POST['name'] . "%0aТелефон:%20" . $_POST['phone'] . "%0aE-mail:%20" . $_POST['email']); header('Location: http://sushki.com.ua/#sucsess'); } else { $stmt = $dbh->prepare("INSERT INTO users(date,title,model,price,name,phone,place,uid) VALUES(:date,:title,:model,:price,:name,:phone,:place,:uid)"); $order_id = $number; $stmt->bindParam(':date', $cdate); $stmt->bindParam(':title', $title); $stmt->bindParam(':model', $model); $stmt->bindParam(':price', $price); $stmt->bindParam(':name', $name); $stmt->bindParam(':phone', $phone); $stmt->bindParam(':place', $place); $stmt->bindParam(':uid', $order); $model = $_POST['model']; $price = $_POST['price']; $name = $_POST['name']; $phone = $_POST['phone']; $place = $_POST['place']; $stmt->execute(); $price = $_GET['price']; } ?> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> <input style='display:none' required id='price' type="text" placeholder="Сумма оплаты" class="small" value="<? echo $_POST['price']?>" /> <input style='display:none' id='desc' type="text" placeholder="Назначение платежа" value="<? echo $_POST['model']?>" class="small"/> <input style='display:none' required id='name' type="text" placeholder="Фамилия" value="<? echo $_POST['name']?>" class="small"/> <button id='sey_ok' type="submit" onclick="make_pay();" class="btn btn_green" style='display:none'>Оплатить</button> <span id='form_responce' style='display:none;'></span> <script> function make_pay(){ if (($('#price').val() == '') || (!/^\d+$/.test($('#price').val()))){ $('#price').css('border-color','red'); } else $.get("makeform.php", { price: $('#price').val(), desc: $('#desc').val(), name: $('#name').val(), phone: $('#phone').val(), }, onAjaxSuccess ); function onAjaxSuccess(data) { $('#form_responce').html(data); $('#form_responce form').submit() } } window.onload = function () { document.getElementById('sey_ok').click() } </script>
Liqpaysite for payment. - Evgeny Nikolaev