Ver Mensaje Individual
  #3 (permalink)  
Antiguo 02/06/2012, 22:17
fillo_mv
 
Fecha de Ingreso: junio-2012
Mensajes: 6
Antigüedad: 12 años, 5 meses
Puntos: 0
Respuesta: Php vincular java scrip menu desplegable y tabla

Código HTML:
Ver original
  1. <?php require_once('../Connections/Prueba.php'); ?>
  2. <title>BIBLIOTECA LABORATORIO DE HIDRAULICA</title>
  3. <script type="text/JavaScript">
  4. <!--
  5. function menu(){
  6. var menu_1=ac
  7. }
  8. function MM_jumpMenu(targ,selObj,restore){ //v3.0
  9. eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"1");
  10. if (restore) selObj.selectedIndex=0;
  11. }
  12. //-->
  13. </head>
  14. <body bgcolor="#0099FF">
  15. <table width="80%" border="0" align="center" cellpadding="0" bgcolor="">
  16. <tr bgcolor="">
  17. <td colspan="3" rowspan="2" nowrap><img src="dh3.jpg" width="230" height="104" >
  18. </td>
  19. <td height="60" nowrap colspan="3" id="logo" valign="bottom"><h2>BIBLIOTECA DEL LABORATORIO DE HIDRAULICA</h2>
  20. </td>
  21. <td width="0"></td>
  22. </tr>
  23. <tr bgcolor="">
  24. <td height="50" colspan="3" valign="TOP" nowrap bgcolor="" id="tagline"><hr><H3>UMSNH</H3></td>
  25. </tr>
  26. <tr>
  27. <td colspan="8" align="center"><H3>INVENTARIO GENERAL </H3></td>
  28. </tr>
  29. <tr>
  30. <td width="196" valign="top" height="370">
  31. <table border="0" cellspacing="0" cellpadding="0" width="155" id="navigation">
  32. <tr>
  33. </tr>
  34. <tr>
  35. <td width="155" height="40" align="center"><a href="javascript:;">DEPARTAMENTO</a></td>
  36. </tr>
  37. <tr>
  38. <td width="155" height="40" align="center"><a href="javascript:;" >LABORATORIO</a></td>
  39. </tr>
  40. <tr>
  41. <td width="155" height="40" align="center"><a href="javascript:;">INGRESAR AL SISTEMA</a></td>
  42. </tr>
  43. <tr>
  44.  
  45. </tr>
  46. </table></td>
  47. <td width="3" bgcolor=""><img src="mm_spacer.gif" alt="" width="1" height="1" border="0"></td>
  48. <td width="30"></td>
  49. <td colspan="2" valign="top"><img src="mm_spacer.gif" alt="" width="304" height="1" border="0"><br>
  50. <table border="0" cellspacing="0" cellpadding="0" width="675">
  51.  
  52. <tr>
  53. </tr>
  54. <td align="center">
  55. <form name="form1" method="post" action="">
  56. VER
  57. <select name="menu1" onChange="javascript:menu()">
  58. <option value="1">TESIS</option>
  59. <option value="2">MEMORIAS</option>
  60. <option value="3">LIBROS</option>
  61. <option value="4">SERIES</option>
  62. <label>BUSCAR
  63. <input name="textarea" type="text" value="">
  64. </label>
  65. <select name="menu2" >
  66. <option value="1">TITULO</option>
  67. <option value="2">AUTOR</option>
  68. <option value="3">NUMERO</option>
  69. </select>
  70. <input type="submit" name="Submit" value="ACTUALIZAR LISTA" onClick=scr"">
  71. </form> </td>
  72. <tr>
  73. <Td>
  74. <table width="100%" border="0">
  75. </Td>  
  76.  
  77. <?php
  78. $db_host = 'localhost';
  79. $db_user = 'root';
  80. $database = 'hidrobib';
  81. $table = 'memorias';
  82. if (!mysql_connect($db_host, $db_user))
  83. die("Can't connect to database");
  84.  
  85. if (!mysql_select_db($database))
  86. die("Can't select database");
  87. // sending query
  88. $result = mysql_query("SELECT * FROM $table ORDER BY $table.Numero");
  89. if (!$result) {
  90. die("Query to show fields from table failed");
  91. }
  92.  
  93. $fields_num = mysql_num_fields($result);
  94. echo "<table border='3' width=100%><tr>";
  95. // printing table headers
  96. for($i=0; $i<$fields_num; $i++)
  97. {
  98. if ($i==0){
  99. $field = mysql_fetch_field($result);
  100. echo "<td width=10%>{$field->name}</td>";
  101. }
  102. else{
  103. $field = mysql_fetch_field($result);
  104. echo "<td>{$field->name}</td>";
  105. }
  106. }
  107. echo "</tr>\n";
  108. // printing table rows
  109. while($row = mysql_fetch_row($result))
  110. {
  111. echo "<tr>";
  112.  
  113. // $row is array... foreach( .. ) puts every element
  114. // of $row to $cell variable
  115. foreach($row as $cell)
  116. echo "<td>$cell</td>";
  117.  
  118. echo "</tr>\n";
  119. }
  120. mysql_free_result($result);
  121. ?>
  122. </tr>
  123. </Td></tr>
  124. </table>    </td>
  125. </table>
  126. <tr>
  127. </tr>
  128. </body>
  129. </html>