PHP - Ayuda formulario

 
Vista:

Ayuda formulario

Publicado por djdrzero (2 intervenciones) el 23/06/2015 10:52:30
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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?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="oriflameval@gmail.com";
$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
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil
Val: 12
Ha aumentado su posición en 15 puestos en PHP (en relación al último mes)
Gráfica de PHP

Ayuda formulario

Publicado por Rafael (40 intervenciones) el 23/06/2015 11:14:44
Vaya no es cosa rara el programa hace lo que le has dicho que haga ...

Me explico y te muestro:
1
2
//$Mail="oriflameval@gmail.com";
$Mail=$_POST['Email'];
Aqui has comentado tu email y le has puesto el que recibes por el el POST a la variable $Mail

Luego entonces cuando mandas el mail para UDS... no es tal es para el USUARIO
1
2
3
4
//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");

El mail para el VISITANTE, lleva el mismo valor por que lo ha pillado del mismo POST!
1
2
3
4
//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");


Vaya espero te sirva esto ....

Saludos
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Ayuda formulario

Publicado por djdrzero (2 intervenciones) el 23/06/2015 11:25:03
Pero le cambio los valores y consigo que a el le le llegue su email pero entonces a mi no me llega
No se como poner los valores ayuda gracias
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de david

Ayuda formulario

Publicado por david (13 intervenciones) el 23/06/2015 18:55:24
en tu codigo

1
2
// en la variable  $Mail pon tu correo directamente así
$Mail="tu_correo@gmail.com";
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar