Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/06/2015, 02:57
djdrzero
 
Fecha de Ingreso: junio-2006
Mensajes: 6
Antigüedad: 17 años, 10 meses
Puntos: 0
Formulario php no devuelve bien

Ante todo gracias por las futuras respuestas
Os cuento
Tengo un formulario en mi web y cuando lo rellenan se envia correctamente pero en vez de llegar al cliente un email y a mi otro con su registro y datos.
Le llegan al cliente los 2 cosa rara.
Este es el codigo como lo tengo puesto.
HTML
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="30%" align="right" scope="col" class="style6"><strong>Nombre &nbsp;</strong></td>
<td width="70%" align="left" scope="col">
<input name="Nombre" type="text" id="Nombre" onfocus="javascript:select()" style="width: 400px" />
* </td>
</tr>
<tr>
<td width="30%" align="right" scope="col" class="style6"><strong>Apellidos&nbsp;</strong></td>
<td width="70%" align="left" scope="col">
<input name="Apellidos" type="text" id="Apellidos" onfocus="javascript:select()" style="width: 400px" />
* </td>
</tr>
<tr>
<td width="30%" align="right" scope="col" class="style6"><strong>DNI o NIE ( y la letra)&nbsp;</strong></td>
<td width="70%" align="left" scope="col">
<input name="dni" type="text" id="dni" onfocus="javascript:select()" style="width: 400px" />
* </td>
</tr>
<tr>
<td width="30%" align="right" scope="col" class="style6"><strong>Fecha nacimiento&nbsp;</strong></td>
<td width="70%" align="left" scope="col">
<input name="Fecha" type="text" id="Fecha" onfocus="javascript:select()" style="width: 126px" />
* </td>
</tr>
<tr>
<td width="30%" align="right" scope="col" class="style6"><strong>Email&nbsp;</strong></td>
<td width="70%" align="left" scope="col">
<input name="Email" type="text" id="Email" onfocus="javascript:select()" style="width: 400px" />
* </td>
</tr>
<tr>
<td width="30%" align="right" scope="col" class="style6"><strong>Direccion&nbsp;</strong></td>
<td width="70%" align="left" scope="col">
<input name="Direccion" type="text" id="Direccion" onfocus="javascript:select()" style="width: 400px" />
* </td>
</tr>
<tr>
<td width="30%" align="right" scope="col" class="style6"><strong>Numero&nbsp;</strong></td>
<td width="70%" align="left" scope="col"> <input name="Numero" type="text" id="Numero" onfocus="javascript:select()" />
* </td>
</tr>

<tr>
<td width="30%" align="right" scope="col" class="style6"><strong>Provincia&nbsp;</strong></td>
<td width="70%" align="left" scope="col">
<input name="Provincia" type="text" id="Provincia" onfocus="javascript:select()" style="width: 209px" />
* </td>
</tr>

<tr>
<td width="30%" align="right" scope="col" class="style6"><strong>Ciudad&nbsp;</strong></td>
<td width="70%" align="left" scope="col">
<input name="Ciudad" type="text" id="Ciudad" onfocus="javascript:select()" style="width: 207px" />
* </td>
</tr>

<td width="30%" align="right" scope="col" class="style6"><strong>Codigo postal&nbsp;</strong></td>
<td width="70%" align="left" scope="col"> <input name="Codigo" type="text" id="Codigo" onfocus="javascript:select()" />
* </td>

<tr>
<td align="right" class="style6"><strong>Telefono&nbsp;</strong></td>
<td align="left"><input name="Telefono" type="text" id="Telefono" onfocus="javascript:select()" />
* </td>
</tr>
<tr>
<td align="right" class="style6"><strong>Movil</strong></td>
<td align="left"><input name="Movil" type="text" id="Movil" onfocus="javascript:select()" /></td>
</tr>
<tr>
<td width="30%" align="right" scope="col" class="style6"><strong>Estas interesad@ por&nbsp;</strong></td>
<td width="70%" align="left" scope="col">
<input name="Interesado" type="text" id="Interesado" onfocus="javascript:select()" style="width: 400px" />
* </td>
</tr>

<tr>
<td align="right" class="style6"><strong>Mensaje&nbsp;</strong></td>
<td align="left">
<textarea name="Comentario" rows="5" id="Comentario" onfocus="javascript:select()" style="width: 400px"></textarea></td>
</tr>
<tr>
<td align="right">&nbsp;</td>
<td align="left"><input name="btnConsulta" type="button" id="btnConsulta" onclick="JavaScript:EnvioConsulta(this)" value="Enviar Consulta" />

PHP
<?php
function CheckEmail($email){
global $error;
$regex = '^([._a-z0-9-]+[._a-z0-9-]*)@(([a-z0-9-]+\.)*([a-z0-9-]+)(\.[a-z]{2,3}))$';
if (!eregi($regex,$email))
return true;
else
return false;
}

if(!isset($_POST['Nombre']) or $_POST['Nombre']=='')
die("Ingrese su nombre");

if(!isset($_POST['Email']) or $_POST['Email']=='')
die("Ingrese su e-mail");

if(CheckEmail($_POST['Email']))
die("El mail ingresado es incorrecto");

if(!isset($_POST['Comentario']) or $_POST['Comentario']=='')
die("Ingrese la consulta");


$cuerpo="";
while (list ($clave, $val) = each ($_POST))
{
if($clave!='Documento')
$cuerpo .= "<b>". $clave . ":</b> " . $val . "<br>";
}

//$Mail="[email protected]";
$Mail=$_POST['Email'];

//MAIL PARA NOSOTROS
mail($Mail, "Has Recibido una consulta", "<font face=verdana size=2>".nl2br($cuerpo)."<br></font>",
"From: {$_POST['Nombre']}<{$_POST['Email']}>\r\n" .
"Content-type: text/html; charset=utf-8\r\n");

//MAIL PARA EL VISITANTE
mail($_POST['Email'], "Recibimos su consulta", "<font face=verdana size=2>Hemos recibido su consulta. Gracias por contactarse con nosotros. <br><br><strong>Sitios Web Ynnova</strong><br>www.paginaswebynnova.com</font>",
"From: Su Pagina<$Mail>\r\n" .
"Content-type: text/html; charset=utf-8\r\n");

die("ok");
?>
Modificar mensaje