Foros del Web » Programando para Internet » PHP »

Combobox/parametros no envia datos para consulta

Estas en el tema de Combobox/parametros no envia datos para consulta en el foro de PHP en Foros del Web. necesito capturar la seleccion del combobox y pasarla al php que tengo dentro de un textbox el que hace una consulta a la BD con ...
  #1 (permalink)  
Antiguo 04/04/2011, 09:08
Avatar de Hs_Jeldres  
Fecha de Ingreso: marzo-2011
Mensajes: 25
Antigüedad: 13 años
Puntos: 0
Pregunta Combobox/parametros no envia datos para consulta

necesito capturar la seleccion del combobox y pasarla al php que tengo dentro de un textbox el que hace una consulta a la BD con los 4 parametros,

Código PHP:
Ver original
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <body>
  4. <table align="center" width="1024" height="586" border="0" cellpadding="0" cellspacing="1">
  5. <tr>
  6. <td width="185" height="83"></td>
  7. <td width="595" >
  8. <div width="595" id="menu_header">
  9. <ul>
  10. <li class="bot_firts bot_menu_01 style1" id="destinos"><a href="">Inicio</a></li>
  11. <li class="bot_menu_02 style1" id="proyecto"><a href="">Proyecto</a></li>
  12. <li class="bot_menu_03 style1" id="sugerencias"><a href="">Sugerencias</a></li>
  13. <li class="bot_menu_04 style1" id="faq's"><a href="">Preguntas Frecuentes</a></li>
  14. </ul>
  15. <div align="center">
  16. </div>
  17. </div>
  18. <div> </div></td>
  19. </tr>
  20. <td width="226"></td>
  21. </tr>
  22. <tr>
  23. <td></td>
  24. <td><p>&nbsp;</p>
  25. <p>&nbsp;</p></td>
  26. </tr>
  27. <tr>
  28. <td><div>
  29. <ul id="menu">
  30. <li><span class="style9"><a href="pasajeros.php" target="_self">Pasajeros y Pasadas</a></span></li>
  31. <li class="style9"><a href="boarding.php" target="_self">DeniedBoardind</a></li>
  32. <li class="style9"><a href="downgrading.php" target="_self">Downgrading</a></li>
  33. <li class="style9"><a href="reclamosequipaje.php" target="_self">R. de Equipaje</a></li>
  34. <li class="style9"><a href="priority.php" target="_self">S. Equipaje Prioriry</a></li>
  35. <li class="style9"><a href="primerayultimamaleta.php" target="_self">Pri. y Ult. Maleta</a></li>
  36. <li class="style9"><a href="velcierre.php" target="_self">Vel. de Cierre</a></li>
  37. <li><span class="style9"><a href="tef.php" target="_self">T. E. F.</a></span></li>
  38. </ul>
  39. <?php
  40. echo 'Bienvenido Al Sistema de Reportes, ';
  41. if (isset($_SESSION['k_username']))
  42. {
  43. echo '<b>'.$_SESSION['k_username'].'</b>.';
  44. echo '<p><a href="logout.php">Logout</a></p>';
  45. }
  46. else
  47. {
  48. }
  49. ?>
  50. </div></td>
  51. <td>
  52. <div align="center">
  53. <p>&nbsp;</p>
  54. <p>&nbsp;</p>
  55. <table width="256" border="0" cellspacing="1" cellpadding="1">
  56. <tr>
  57. <td width="100" height="27"></td>
  58. <td width="30">
  59. <form action="algo.php" method="post">
  60. <select name="ato">
  61. <option><?php ?></option>
  62. <?php
  63. include("conexion4.php");
  64. $link=Conectarse();
  65. $result = mysql_query("SELECT sigla FROM agrupa_postas order by sigla ");
  66. echo '<option>%</option>';
  67. while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
  68. {
  69. echo '<option>'.$row["sigla"].'</option>';
  70. }
  71. ?>
  72. </select>
  73. </form>
  74. </td>
  75. <td width="36"></td>
  76. <td width="11">
  77. <form action="algo.php" method="post">
  78. <select name="opera">
  79. <option></option>
  80. <?php
  81. $result = mysql_query("SELECT sigla FROM operador order by sigla ");
  82. echo '<option>%</option>';
  83. while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
  84. {
  85. echo '<option>'.$row["sigla"].'</option>';
  86. }
  87. ?>
  88. </select>
  89. </form></td>
  90. <td width="11">
  91. </td>
  92. </tr>
  93. <tr>
  94. <td></td>
  95. <td><form action="algo.php" method="post">
  96. <select name="nego">
  97. <option></option>
  98. echo '<option>%</option>';
  99. <?php
  100. $result = mysql_query("SELECT sigla FROM negocio order by sigla ");
  101. while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
  102. {
  103. echo '<option>'.$row["sigla"].'</option>';
  104. }
  105. ?>
  106. </select>
  107. </form></td>
  108. <td></td>
  109. <td><form name="form" action="algo.php" method="post">
  110. <select  name="mes_" onchange='document.form.mes_dinamic.value=this.options
  111. [this.options.selectedIndex].value'>
  112. <option></option>
  113. <?php
  114. $result = mysql_query("SELECT id_mes FROM pagina_mes ");
  115. while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
  116. {
  117. echo '<option>'.$row["id_mes"].'</option>';
  118. }
  119. ?>
  120. </select>
  121. <input name="Submit" type="submit" value="___________"> </form>
  122. <td>            
  123. </table>
  124. <p>&nbsp;</p>
  125. <table width="734"  align="center" border="0" cellspacing="0">
  126. <tr>
  127. <td width="120" height="20"><div align="left"></div></td>
  128. <td    border:0 background="simbolos/fondo_imput.jpg"colspan="3"><div align="center"><input type="text" name='mes_dinamic'   maxlength="100"  height="17" width="300" style="background-color:transparent;border:0" readonly="">
  129. <td colspan="3"><div align="left">
  130. <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="305" height="26">
  131. <param name="movie" value="flash/btn_lan_mes_acumulado.swf">
  132. <param name="quality" value="high">
  133. <embed src="flash/btn_lan_mes_acumulado.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="305" height="26"></embed>
  134. </object>
  135. </div></td>
  136. </tr>
  137. <tr>
  138. <td><div align="left">
  139. </div></td>
  140. <td width="100"><div align="left">
  141. </div></td>
  142. <td width="100"><div align="left">
  143. </div></td>
  144. <td width="100"><div align="left">
  145. </div></td>
  146. <td width="100"><div align="left">
  147. </div></td>
  148. <td width="100"><div align="left">
  149. </div></td>
  150. <td width="100"><div align="left">
  151. </div></td>
  152. </tr>
  153. <tr>
  154. <td>
  155. <div align="right">
  156. </div></td>
  157. <td>
  158. <div align="right">
  159. <input type=text name=m_pas size="10" maxlength="25" readonly="">
  160. </div></td>
  161. <td>
  162. <div align="right">
  163. <input type=text name=r_pas size="10" maxlength="16" readonly="" value="    <?php
  164. include("conexion2.php");
  165. $ato=$_POST["ato"];
  166. $nego=$_POST["nego"];
  167. $opera=$_POST["opera"];
  168. $mes_=$_POST["mes_"];
  169. $query = "CALL sp_cal_pas('".$ato."','".$nego."','".$opera."','".$mes_."')";
  170. die($query);
  171. mysqli_multi_query($link, $query);
  172. $result = mysqli_store_result($link);
  173. while ($row = mysqli_fetch_row($result))
  174. {
  175. echo "$row[0]";
  176. }
  177. ?>">
  178. </div></td>
  179. <td>
  180. <div align="right">
  181. <input type=text name=p_pas maxlength="16"  size="10" readonly="" value="">
  182. </div></td>
  183. <td>
  184. <div align="right">
  185. <input type=text name=acu_m_pas size="10" maxlength="16" readonly="">
  186. </div></td>
  187. <td>
  188. <div align="right">
  189. <input type=text name=acu_r_pas size="10" maxlength="16" readonly="">
  190. </div></td>
  191. <td>
  192. <div align="right">
  193. <input  class="" type=text name=acu_p_pas size="10" maxlength="16" value="" readonly="">
  194. </div></td></tr>
  195. <tr>
  196. <td height="27">
  197. <div align="right">
  198. </div></td>
  199. <td>
  200. <div align="right">
  201. <input type=text name=m_pax size="10" maxlength="16" readonly="">
  202. </div></td>
  203. <td>
  204. <div align="right">
  205. <input type=text name=r_pax size="10" maxlength="16" readonly="">
  206. </div></td>
  207. <td>
  208. <div align="right">
  209. <input type=text name=p_pax size="10" maxlength="16" value="" readonly="">
  210. </div></td>
  211. <td>
  212. <div align="right">
  213. <input type=text name=acu_m_pax size="10" maxlength="16" readonly="">
  214. </div></td>
  215. <td>
  216. <div align="right">
  217. <input type=text name=acu_r_pax size="10" maxlength="16" readonly="">
  218. </div></td>
  219. <td>
  220. <div align="right">
  221. <input type=text name=acu_p_pax size="10" maxlength="16" readonly="">
  222. </div></td></tr>
  223. </table>
  224. <p>&nbsp;</p>
  225. </div></td>
  226. </tr>
  227. <tr>
  228. <td height="26"><div> </div></td>
  229. <td><div align="center">&copy; 2011 - Todos los derechos reservados. <span class="style7">desing by <a href="log_gestion.php">Equipo de Gesti&oacute;n</a></span></div></td>
  230. <td></td>
  231. </tr>
  232. </table>
  233. </body>
  234. </html>

creo que el problema cae en el exceso de <form></form> pero saco y pongo y no pasa nada? ayuda soy novato...
  #2 (permalink)  
Antiguo 05/04/2011, 02:47
 
Fecha de Ingreso: marzo-2010
Ubicación: Barcelona
Mensajes: 657
Antigüedad: 14 años
Puntos: 26
Respuesta: Combobox/parametros no envia datos para consulta

El problema de poner 4 forms y de solo poner un submit es que cuando hagas clic en el boton solo enviarás los datos del formulario en el cual pusiste el submit. Por lo tanto lo que has de hacer es poner los 4 selects en el mismo formulario. El tuyo quedaria algo asi:
Código PHP:
<form name="form" action="algo.php" method="post">
<table>
    <tr>
        <td width="100" height="27"></td>
        <td width="30">
            <select name="ato">
                <option></option>
                <?php echo '<option></option>'?>
            </select>
        </td>
        <td width="36"></td>
        <td width="11">
            <select name="opera">
                <option></option>
                <?php echo '<option></option>'?>
            </select>
        </td>
        <td width="11">
        </td>
    </tr>
    <tr>
        <td></td>
        <td>
            <select name="nego">
                <option></option>
            </select>
        </td>
        <td></td>
        <td>
            <select  name="mes_" onchange='document.form.mes_dinamic.value=this.options[this.options.selectedIndex].value'>
                <option></option>
            </select>
            <input name="Submit" type="submit" value="Enviar">
        <td>  
    </tr>
</table>
</form>
Ahora rellenalo con las consultas a la BD que quieras y me dices como ha ido.
Por cierto, vigila que tenias algunos errores, por ejemplo en la linea 66 haces un echo sin decirle que es php.
Sugerencia, para no uilizar más espacio del que necesitas no asignes para cada $_POST una variable si sólo la vas a utilizar una vez. Para eso utiliza $_POST y acabaras mas rapidamente.

Código PHP:
$query "CALL sp_cal_pas('".$_POST["ato"]."','".$_POST["nego"]."','".$_POST["opera"]."','".$_POST["mes_"]."')"
__________________
Siempre fallaras el 100% de los tiros que no te atrevas a lanzar.
El 98% de los adolescentes han fumado, si eres del dichoso 2% que no lo ha hecho, copia y pega esto en tu firma.
  #3 (permalink)  
Antiguo 05/04/2011, 06:09
Avatar de Hs_Jeldres  
Fecha de Ingreso: marzo-2011
Mensajes: 25
Antigüedad: 13 años
Puntos: 0
De acuerdo Respuesta: Combobox/parametros no envia datos para consulta

MUCHISIMAS GRACIAS Vallu !

quedo genial, de verdad te pasaste mil gracias.

Etiquetas: Ninguno
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 13:50.