Enviar 2 formulario con un html
Saludos, estoy tratando de enviar dos formularios, form1 y form2 desde un solo archivo html... el codigo es el siguiente:
<html><head></head>
<body><center>
<form name="form1" action="form1.php" method="post" enctype="text/plain">
<input type="hidden" name="accion" value="Form1">
Escriba su Nombre <br>
<input name="nombre" value="" size="50" type="text"><br><br>
Escriba su Correo Electrónico <br>
<input name="email" value="" size="50" type="text"><br><br>
<input value="Enviar" type="submit">
</form>
<form name="form2" action="form2.php" method="post" enctype="text/plain">
<input type="hidden" name="accion" value="Form2">
Escriba su Nombre <br>
<input name="nombre2" value="" size="50" type="text"><br><br>
Escriba su Correo Electrónico <br>
<input name="email2" value="" size="50" type="text"><br><br>
<input value="Enviar" type="submit">
</form>
</center></body></html>
El script php (form1.php) del action es este:
<?php
if ($accion == "Form1"){
$to_email="[email protected]";
$time = date("l dS of F Y h:i:s A");
$headers="Formulario2";
$mensaje="Formulario de Contacton<br>";
$mensaje.="---------------------------------------------------n<br>";
$mensaje.="Nombre: $nombre2n<br>";
$mensaje.="E-mail: $email2nn<br>";
$mensaje.="---------------------------------------------------n<br>";
$mensaje.="---------------------------------------------------n<br>";
$mensaje.="fecha : $timen<br>";
$mensaje.= "operación hecha desde $REMOTE_ADDRn<br>";
$cabecera = "From: [email protected]:text/htmlrn";
mail($to_email,$headers,$mensaje,$cabecera);
}
?>
Trate de hacerlo con un solo php... preguntando por el valos de accion y llegaban los mensajes pero no los datos,
Ahora que lo estopy haciendo asà con dos scripts php ni siquiera llegan los mensajes...
Cualquier ide muchas gracias!
<html><head></head>
<body><center>
<form name="form1" action="form1.php" method="post" enctype="text/plain">
<input type="hidden" name="accion" value="Form1">
Escriba su Nombre <br>
<input name="nombre" value="" size="50" type="text"><br><br>
Escriba su Correo Electrónico <br>
<input name="email" value="" size="50" type="text"><br><br>
<input value="Enviar" type="submit">
</form>
<form name="form2" action="form2.php" method="post" enctype="text/plain">
<input type="hidden" name="accion" value="Form2">
Escriba su Nombre <br>
<input name="nombre2" value="" size="50" type="text"><br><br>
Escriba su Correo Electrónico <br>
<input name="email2" value="" size="50" type="text"><br><br>
<input value="Enviar" type="submit">
</form>
</center></body></html>
El script php (form1.php) del action es este:
<?php
if ($accion == "Form1"){
$to_email="[email protected]";
$time = date("l dS of F Y h:i:s A");
$headers="Formulario2";
$mensaje="Formulario de Contacton<br>";
$mensaje.="---------------------------------------------------n<br>";
$mensaje.="Nombre: $nombre2n<br>";
$mensaje.="E-mail: $email2nn<br>";
$mensaje.="---------------------------------------------------n<br>";
$mensaje.="---------------------------------------------------n<br>";
$mensaje.="fecha : $timen<br>";
$mensaje.= "operación hecha desde $REMOTE_ADDRn<br>";
$cabecera = "From: [email protected]:text/htmlrn";
mail($to_email,$headers,$mensaje,$cabecera);
}
?>
Trate de hacerlo con un solo php... preguntando por el valos de accion y llegaban los mensajes pero no los datos,
Ahora que lo estopy haciendo asà con dos scripts php ni siquiera llegan los mensajes...
Cualquier ide muchas gracias!