Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/04/2016, 12:18
alejandro896
 
Fecha de Ingreso: abril-2016
Ubicación: venezuela
Mensajes: 5
Antigüedad: 8 años, 1 mes
Puntos: 0
Exclamación pasar variables de html a php

buenas tardes amigos estoy intentando hacer una web en la cual tengo un formulario html y envio los datos a un php el cual recibe los datos, rellena otros y hace envio a un tercer php, el inconveniente se presenta porque pierdo los datos del html, podrian ayudarme?

Código HTML:
Ver original
  1. <!doctype html>
  2. <html lang=''>
  3.    <meta charset='utf-8'>
  4.    <meta http-equiv="X-UA-Compatible" content="IE=edge">
  5.    <meta name="viewport" content="width=device-width, initial-scale=1">
  6.    <link rel="stylesheet" href="styles.css">
  7.    <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
  8.    <script src="script.js"></script>  
  9.  
  10. </head>
  11.  
  12. <div>
  13. <h5>SERIE</h5>
  14. <form name="serie" id="serie" method="post" action="pagina2.php">
  15. <table width="294" border="0" cellpadding="0" cellspacing="0">
  16.   <tr>
  17.     <td width="20" height="22">
  18.       <label><input type="radio" name="radio2" id="radio2" value="OPCION1"></label>
  19.     </td>
  20.     <td width="274"><h6 style="margin:0;">OPCION1</h6></td>
  21.   </tr>
  22.   <tr>
  23.     <td height="22">
  24.       <label><input type="radio" name="radio2" id="radio2" value="OPCION2"></label>
  25.     </td>
  26.     <td><h6 style="margin:0;">OPCION2</h6></td>
  27.   </tr>
  28. <br>
  29. <CENTER><input type="image" src="images/sig.png" name="submit" value="Enviar"></CENTER>
  30. </form>
  31. </div>
  32.  
  33. </body>

PAGINA2
Código PHP:
Ver original
  1. <!doctype html>
  2. <html lang=''>
  3. <head>
  4.    <meta charset='utf-8'>
  5.    <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6.    <meta name="viewport" content="width=device-width, initial-scale=1">
  7.    <link rel="stylesheet" href="styles.css">
  8.    <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
  9.    <script src="script.js"></script>
  10.  
  11. <?php
  12.  
  13. $_SESSION['radio2'] = $_POST['radio2'];  
  14. ?>  
  15. </head>
  16. <body>
  17.  
  18. <form name="serie" id="serie" method="post" action="pagina3.php">
  19.  
  20. <table width="294" border="0">
  21.   <tr>
  22.     <td width="54"><h6 style="margin:0;">Nombre:</h6></td>
  23.     <td width="224"><input name="nombre" type="text" id="nombre" style="background-color:#CCCCCC" size="25" maxlength="30" required/></td>
  24.   </tr>
  25.   <tr>
  26.     <td><h6 style="margin:0;">Apellido:</h6></td>
  27.     <td><input name="apellido" type="text" id="apellido" style="background-color:#CCCCCC" size="25" maxlength="30" required/></td>
  28.   </tr>
  29.   <tr>
  30.     <td><h6 style="margin:0;">Tlf:</h6></td>
  31.     <td><input name="tlf" type="text" id="tlf" style="background-color:#CCCCCC" size="25" maxlength="15" required/></td>
  32.   </tr>
  33.   <tr>
  34.     <td><h6 style="margin:0;">Email:</h6></td>
  35.     <td><input name="mail" type="text" id="mail" style="background-color:#CCCCCC" size="25" required/></td>
  36.   </tr>
  37. </table><br>  
  38. <center>
  39. <input type="image" src="images/sig.png" name="submit" value="Enviar">
  40. </center>
  41. </form>
  42.  
  43.  
  44. </body>
  45. <html>

PAGINA 3
Código PHP:
Ver original
  1. <?php
  2. $_SESSION['radio2'] = $_POST['radio2'];
  3. $opcion = $_POST['radio2'];
  4. $opcion2 = $_POST['opcion'];
  5. $opcion4 = $_SESSION['radio2'];
  6. $nombre = $_POST['nombre'];
  7. $apellido = $_POST['apellido'];
  8. $tlf = $_POST['tlf'];
  9. $mail = $_POST['mail'];
  10. $header = 'From: ' . $mail . " \r\n";
  11. $header .= "X-Mailer: PHP/" . phpversion() . " \r\n";
  12. $header .= "Mime-Version: 1.0 \r\n";
  13. $header .= "Content-Type: text/plain";
  14. $mensaje .= "SELECCIÓN DEL CHECKBOX: " . $_SESSION['radio2'] . " \r\n\n";
  15. $mensaje .= "Este mensaje fue enviado por: \r\n\n";
  16. $mensaje .= "Nombre: " . $nombre . " \r\n";
  17. $mensaje .= "Apellido: " . $apellido . " \r\n";
  18. $mensaje .= "Telefono: " . $tlf . " \r\n";
  19. $mensaje .= "Su e-mail es: " . $mail . " \r\n";
  20. $mensaje .= "Enviado el: " . date('d/m/Y', time());
  21.  
  22. $asunto = 'SOLICITUD';
  23.  
  24. mail($para, $asunto, utf8_decode($mensaje), $header);
  25. echo "<script>document.location.href='index.html';</script>\n";  
  26.  
  27. ?>