Ver Mensaje Individual
  #4 (permalink)  
Antiguo 02/07/2011, 12:18
ignacio350
 
Fecha de Ingreso: junio-2011
Ubicación: Ccs
Mensajes: 27
Antigüedad: 12 años, 10 meses
Puntos: 3
Respuesta: Cerrar sesión & Consulta

Aqui Dejo el Codigo
Código PHP:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Agencia de Viajes</title>
  6. <link rel="stylesheet" type="text/css" href="vuelos.css"/>
  7.  
  8. </head>
  9. <body>
  10. <?php
  11. if(!isset($_SESSION["login"])){
  12.    
  13.  
  14. ?>
  15.  
  16. <fieldset id="form">
  17. <legend align="center">ALERTA</legend>
  18. <p align="center" >No ha iniciado sesion <a href="../login.php">Identifiquese</a> en nuestro sistema.</p><br>
  19. <p align="center" >Sino esta registrado puede  <a href="../registro.php">Registrarse</a></p><br>
  20. </fieldset>
  21. <?php
  22. }
  23. else {
  24.   if($_POST['origen']==$_POST['destino']){
  25.       ?>
  26.       <form action="comprar1.php" method="post" >
  27. <fieldset id="identi">
  28. <legend align="center">ALERTA</legend><BR>
  29.   <div align="center">
  30.   <p align="center" >Por Favor Seleccione dos Ubicaciones Distintas  </p><br>
  31.   <input type="hidden" name="aerolinea" value="<?php echo $_POST['aerolinea']; ?>">
  32.  <input type="submit" value="Regresar" class="btn" onclick = "this.form.action = 'comprar1.php'" />
  33.   </div>
  34.  
  35.   <?php
  36.   } else {
  37. $origen=$_POST['origen'];
  38. $destino=$_POST['destino'];
  39. $aerolinea=$_POST['aerolinea'];
  40.  
  41.  
  42.  
  43. $conexion= mysql_connect ("localhost", "ignacio", "xtreme")
  44. or die ("No se puede conectar con el servidor");
  45.  
  46. mysql_select_db ("agencia")
  47. or die ("No se puede seleccionar la base de datos");
  48.    
  49.     $consulta=mysql_query("SELECT id,codavion,origen,destino,partida FROM vuelos where relacion='$aerolinea' && origen='$origen' && destino='$destino'");
  50.     $consulta2=mysql_query("SELECT id,codavion,origen,destino,partida FROM vuelos where relacion='$aerolinea' && origen='$destino' && destino='$origen'");
  51.     $prueba=mysql_query("SELECT id,codavion,origen,destino,partida FROM vuelos where relacion='$aerolinea' && origen='$destino' && destino='$origen'");
  52. ?>
  53.     <form action="comprar3.php" method="post" >
  54. <?php
  55. $prueba_row=mysql_fetch_row($prueba);
  56. if($prueba_row){  ?>
  57.  
  58.  
  59.  
  60.     <fieldset id="identi">
  61. <legend align="center   ">SELECCIONE EL HORARIO DE SU PREFERENCIA</legend><BR>
  62.   <div align="center">
  63.    <table width="93%" border="1">
  64.   <tr>
  65.     <th width="9%">Vuelo</th>
  66.     <th width="16%" >Origen</th>
  67.     <th width="15%" >Destino</th>
  68.     <th width="9%" >Hora</th>
  69.     <th width="20%" >Fecha</th>
  70.      <th width="15%" >Clase</th>
  71.     <th width="16%" >Selección</th>
  72.   </tr>
  73.  
  74.     <?php
  75.     // Voy imprimiendo el primer select compuesto por los paises
  76.    
  77.     while($registro=mysql_fetch_row($consulta))
  78.     { ?> <tr>
  79.     <th><?php echo"".$registro[1]."";?>  </th>
  80.     <th ><?php echo"".$registro[2]."";?> </th>
  81.     <th ><?php echo"".$registro[3]."";?></th>
  82.     <th ><?php echo"".$registro[4]."";?></th>
  83.     <th width="20%" ><SELECT class="nac" name="mesida"> <OPTION value="NULL" selected>Mes</OPTION>
  84.                           <OPTION value=1>Enero</OPTION> <OPTION
  85.                           value=2>Febrero</OPTION> <OPTION value=3>Marzo</OPTION>
  86.                           <OPTION value=4>Abril</OPTION> <OPTION
  87.                           value=5>Mayo</OPTION> <OPTION value=6>Junio</OPTION>
  88.                           <OPTION value=7>Julio</OPTION> <OPTION
  89.                           value=8>Agosto</OPTION> <OPTION value=9>Septiembre</OPTION>
  90.                           <OPTION value=10>Octubre</OPTION> <OPTION
  91.                           value=11>Noviembre</OPTION> <OPTION
  92.                         value=12>Diciembre</OPTION></SELECT> <SELECT name="diaida" class="nac">
  93.                           <OPTION value="NULL" selected>Día</OPTION>
  94.                           <OPTION>1</OPTION> <OPTION>2</OPTION>
  95.                           <OPTION>3</OPTION> <OPTION>4</OPTION>
  96.                           <OPTION>5</OPTION> <OPTION>6</OPTION>
  97.                           <OPTION>7</OPTION> <OPTION>8</OPTION>
  98.                           <OPTION>9</OPTION> <OPTION>10</OPTION>
  99.                           <OPTION>11</OPTION> <OPTION>12</OPTION>
  100.                           <OPTION>13</OPTION> <OPTION>14</OPTION>
  101.                           <OPTION>15</OPTION> <OPTION>16</OPTION>
  102.                           <OPTION>17</OPTION> <OPTION>18</OPTION>
  103.                           <OPTION>19</OPTION> <OPTION>20</OPTION>
  104.                           <OPTION>21</OPTION> <OPTION>22</OPTION>
  105.                           <OPTION>23</OPTION> <OPTION>24</OPTION>
  106.                           <OPTION>25</OPTION> <OPTION>26</OPTION>
  107.                           <OPTION>27</OPTION> <OPTION>28</OPTION>
  108.                           <OPTION>29</OPTION> <OPTION>30</OPTION>
  109.                           <OPTION>31</OPTION></SELECT> <SELECT name="anoida" class="nac">
  110.                           <OPTION value="NULL" selected>Año</OPTION>
  111.                          <OPTION
  112.                           value="2012">2012</OPTION> <OPTION
  113.                           value="2011">2011</OPTION> </SELECT></th>
  114.                            <th ><SELECT class="nac" name="clase"> <OPTION value="NULL" selected>Clase</OPTION>
  115.                           <OPTION value="VIP">V.I.P</OPTION> <OPTION
  116.                           value="PRI">Primera Clase</OPTION> <OPTION value="ECO">Economica</OPTION>
  117.                           </SELECT>  </th>
  118.     <th ><INPUT type="radio" name="partida" value="<?php echo"".$registro[4]."";?>"></th>
  119.   </tr>
  120.                  
  121.     <?php }?>
  122.      </table>
  123.      <BR>
  124.      <table width="93%" border="1">
  125.   <tr>
  126.     <th width="9%">Vuelo</th>
  127.     <th width="16%" >Origen</th>
  128.     <th width="15%" >Destino</th>
  129.     <th width="9%" >Hora</th>
  130.     <th width="20%" >Fecha</th>
  131.      <th width="15%" >Clase</th>
  132.     <th width="16%" >Selección</th>
  133.   </tr>
  134. <?php
  135.     while($registro=mysql_fetch_row($consulta2))
  136.     { ?>
  137.    
  138.    
  139.  
  140.         <tr>
  141.     <th><?php echo"".$registro[1]."";?>  </th>
  142.     <th ><?php echo"".$registro[2]."";?> </th>
  143.     <th ><?php echo"".$registro[3]."";?></th>
  144.     <th ><?php echo"".$registro[4]."";?></th>
  145.     <th width="20%" ><SELECT class="nac" name="messo"> <OPTION value="NULL" selected>Mes</OPTION>
  146.                           <OPTION value=1>Enero</OPTION> <OPTION
  147.                           value=2>Febrero</OPTION> <OPTION value=3>Marzo</OPTION>
  148.                           <OPTION value=4>Abril</OPTION> <OPTION
  149.                           value=5>Mayo</OPTION> <OPTION value=6>Junio</OPTION>
  150.                           <OPTION value=7>Julio</OPTION> <OPTION
  151.                           value=8>Agosto</OPTION> <OPTION value=9>Septiembre</OPTION>
  152.                           <OPTION value=10>Octubre</OPTION> <OPTION
  153.                           value=11>Noviembre</OPTION> <OPTION
  154.                         value=12>Diciembre</OPTION></SELECT> <SELECT name="diaso" class="nac">
  155.                           <OPTION value="NULL" selected>Día</OPTION>
  156.                           <OPTION>1</OPTION> <OPTION>2</OPTION>
  157.                           <OPTION>3</OPTION> <OPTION>4</OPTION>
  158.                           <OPTION>5</OPTION> <OPTION>6</OPTION>
  159.                           <OPTION>7</OPTION> <OPTION>8</OPTION>
  160.                           <OPTION>9</OPTION> <OPTION>10</OPTION>
  161.                           <OPTION>11</OPTION> <OPTION>12</OPTION>
  162.                           <OPTION>13</OPTION> <OPTION>14</OPTION>
  163.                           <OPTION>15</OPTION> <OPTION>16</OPTION>
  164.                           <OPTION>17</OPTION> <OPTION>18</OPTION>
  165.                           <OPTION>19</OPTION> <OPTION>20</OPTION>
  166.                           <OPTION>21</OPTION> <OPTION>22</OPTION>
  167.                           <OPTION>23</OPTION> <OPTION>24</OPTION>
  168.                           <OPTION>25</OPTION> <OPTION>26</OPTION>
  169.                           <OPTION>27</OPTION> <OPTION>28</OPTION>
  170.                           <OPTION>29</OPTION> <OPTION>30</OPTION>
  171.                           <OPTION>31</OPTION></SELECT> <SELECT name="anoso" class="nac">
  172.                           <OPTION value="NULL" selected>Año</OPTION>
  173.           <OPTION
  174.                           value="2012">2012</OPTION> <OPTION
  175.                           value="2011">2011</OPTION> </SELECT></th>
  176.     <th ><SELECT class="nac" name="claseso"> <OPTION value="NULL" selected>Clase</OPTION>
  177.                           <OPTION value="VIP">V.I.P</OPTION> <OPTION
  178.                           value="PRI">Primera Clase</OPTION> <OPTION value="ECO">Economica</OPTION>
  179.                           </SELECT>  </th>
  180.     <th ><INPUT type="radio" name="venida" value="<?php echo"".$registro[4]."";?>"> </th>
  181.   </tr>
  182.     <?php }
  183.     ?></table>
  184.     <BR> <BR>
  185.    
  186.  
  187. <input type="hidden" name="aerolinea" value="<?php echo $_POST['aerolinea']; ?>">
  188. <input type="hidden" name="origen" value="<?php echo $_POST['origen']; ?>">
  189. <input type="hidden" name="destino" value="<?php echo $_POST['destino']; ?>">    
  190. <input type="submit" value="Regresar" class="btn" onclick = "this.form.action = 'comprar1.php'" />
  191. <input type="submit" value="Siguiente" class="btn"  onclick = "this.form.action = 'comprar3.php'" />
  192.  
  193. <BR><BR>
  194.  
  195. </fieldset>
  196. <?php
  197. }
  198.    else {
  199. ?>
  200. <form action="comprar1.php" method="post" >
  201. <fieldset id="identi">
  202. <legend align="center">ALERTA</legend><BR>
  203.   <div align="center">
  204.   <p align="center" >No Tenemos Vuelos Disponibles  </p><br>
  205.   <input type="hidden" name="aerolinea" value="<?php echo $_POST['aerolinea']; ?>">
  206.  <input type="submit" value="Regresar" class="btn" onclick = "this.form.action = 'comprar1.php'" />
  207.   </div>
  208.   <?php } }}
  209.  
  210. ?>
  211.  
  212.  
  213.  
  214.  
  215. </body>
  216. </html>
He encontrado el problema por el cual la consulta no me funciona pondre una imagen de como se muestra el codigo



La cuestion es que tengo los select con el mismo nombre :(