function sendEmail() {
var email = $('#email').val();
var shipment = $('shipment').val();
if (ename!='' && email!='' && ephone!='') {
if (isEmpty(cart)) {
$.post(
"core/mail.php",
{
'ename' : ename,
'email' : email,
'shipment': shipment
},
function(data){
if (data == 1) {
alert('Заказ отправлен');
}
else {
alert('Повторите заказ')
}
}
);
}
else {
alert('Корзина пуста!');
}
}
else {
alert('Заполните все поля!');
}
}
<div class="popup-options">
<div class="popup-options__shipment">
<h2 class="popup-options__title">Доставка</h2>
<p><input type="radio" name="shipment" value="subway">Забрать у метро</p>
<p><input type="radio" name="shipment" value="self">Самовывоз</p>
<p><input type="radio" name="shipment" value="courier">Курьер</p>
<p><input type="radio" name="shipment" value="post">Почта</p>
</div>
</div>
<?
$message .= '<p>Shipment: '.$_POST['shipment'].'</p>';
$to = 'mail@mail'.',';
$to .=$_POST['email'];
$spectext = '<!DOCTYPE HTML><html><head><title>Заказ</title></head><body>';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$m = mail($to, 'Order', $spectext.$message.'</body></html>', $headers);
if ($m) {echo 1;} else {echo 0;}
?>