PHP - transferencia de datos entre 2 php

 
Vista:
sin imagen de perfil

transferencia de datos entre 2 php

Publicado por jose maria (45 intervenciones) el 06/07/2014 19:53:25
hola, tengo un php donde parte del codigo es

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
$order=date('ymdHis');
$phpdato1=$_POST['dato1'];
$phpdato2=$_POST['dato2'];
$phpdato3=$_POST['dato3'];
$palabra = "abcdef";
$envio='enviomail.php';
$mensaje = "Hola";
echo "
<html>
<head>
<title></title>
<script language='JavaScript'>
function calc() { 
vent=window.open('http://www.google.com','_blank');
window.open('enviomail.php','_self');
}
</script>
</head>
<body>
<form name=compra >
Datos:
   <br>
   Dato 1:
   $phpdato1
   <br>
   Dato 2:
   $phpdato2
   <br>
     Dato 3:
   $phpdato3
   <br>
     Palabra:
  $palabra 
   <br>
   Referencia:
  $order
   <br>
   <a href='index.html'><img src='img/b_volver.png' width='94' height='31'/></a><a href='javascript:calc()'><img src='img/b_ok.png' width='94' height='31' /></a>
</form>	
<form name=envio action=enviomail.php method=post>		
<input type=hidden name=Nombre value='NOMBRE'>
<input type=hidden name=orderphp  value='$order'>
<input type=hidden name=dato1php  value='$phpdato1'>
<input type=hidden name=dato2php  value='$phpdato2'>
<input type=hidden name=dato3php  value='$phpdato3'>
<input type=hidden name=palabraphp  value='$palabra'>
<input type=hidden name=emailphp value='MIO@gmail.com'>
<input type=hidden name=asuntophp value='ASUNTO'>
<input type=hidden name=mensajephp value='$mensaje'>
</form> 												  
</body></html>
";
?>

por otra parte tengo el otro php, enviomail:

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
<?
$bphpdato1=$_POST['dato1php'];
$bphpdato2=$_POST['dato2php'];
$bphpdato3=$_POST['dato3php'];
$bpalabra = $_POST['palabraphp'];
$bphporder = $_POST['orderphp'];
$bemail_destino=$_POST['emailphp'];
$basunto=$_POST['asuntophp'];
$bmensaje=$_POST['mensajephp'];
 
$cabeceras = "MIME-Version: 1.0" . "\r\n";
$cabeceras .= "Content-type: text/html; charset=utf-8" . "\r\n";
$cabeceras .= "From: YO <".$bemail_destino.">" . "\r\n";
$mensaje = "
<html>
<head>
 <title>Envio desde web</title>
</head>
<body>
<div>
palabra=".$bpalabra."<br>
dato 1= ".$bphpdato1."<br>
dato 2= ".$bphpdato2."<br>
dato 3= ".$bphpdato3."<br>
referencia= ".$bphporder."<br>
mensaje= ".$bmensaje."
</div>
</body>
</html>";
echo $mensaje;
if (mail($bemail_destino,utf8_decode($basunto),$mensaje,$cabeceras)){
 ?><script type="text/javascript">alert("Su mensaje se ha enviado correctamente.");</script><?
 }else{
 ?><script type="text/javascript">alert("Se ha producido un error durante el envio.");</script><?
 }
?>

las dudas o problemas son:
1) se pueden enviar datos entre dos php utilizando
<form name=envio action=enviomail.php method=post> (este dentro de un echo)
2) no se envia el email ni tampoco la visualizacion de los datos (parece que no llegan)
¿como lo soluciono?

gracias
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