02/06/2012, 20:44
|
| | Fecha de Ingreso: junio-2012
Mensajes: 6
Antigüedad: 12 años, 5 meses Puntos: 0 | |
Php vincular java scrip menu desplegable y tabla Bueno,soy nuevo en php.Anteriormente he trabajado un poco con asp y tengo cierta referencia pero me es insuficiente. Bueno; aqui esta el codigo de la pagina que estoy desarrollando.
Tiene un desplegable para cambiar la tabla, no se si me puedan ayudar con eso
<?php require_once('../Connections/Prueba.php'); ?>
<html>
<head>
<title>BIBLIOTECA LABORATORIO DE HIDRAULICA</title>
<script type="text/JavaScript">
<!--
function menu(){
var menu_1=ac
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"1");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>
<body bgcolor="#0099FF">
<table width="80%" border="0" align="center" cellpadding="0" bgcolor="">
<tr bgcolor="">
<td colspan="3" rowspan="2" nowrap><img src="dh3.jpg" width="230" height="104" >
</td>
<td height="60" nowrap colspan="3" id="logo" valign="bottom"><h2>BIBLIOTECA DEL LABORATORIO DE HIDRAULICA</h2>
</td>
<td width="0"></td>
</tr>
<tr bgcolor="">
<td height="50" colspan="3" valign="TOP" nowrap bgcolor="" id="tagline"><hr><H3>UMSNH</H3></td>
</tr>
<tr>
<td colspan="8" align="center"><H3>INVENTARIO GENERAL </H3></td>
</tr>
<tr>
<td width="196" valign="top" height="370">
<table border="0" cellspacing="0" cellpadding="0" width="155" id="navigation">
<tr>
</tr>
<tr>
<td width="155" height="40" align="center"><a href="javascript:;">DEPARTAMENTO</a></td>
</tr>
<tr>
<td width="155" height="40" align="center"><a href="javascript:;" >LABORATORIO</a></td>
</tr>
<tr>
<td width="155" height="40" align="center"><a href="javascript:;">INGRESAR AL SISTEMA</a></td>
</tr>
<tr>
</tr>
</table></td>
<td width="3" bgcolor=""><img src="mm_spacer.gif" alt="" width="1" height="1" border="0"></td>
<td width="30"></td>
<td colspan="2" valign="top"><img src="mm_spacer.gif" alt="" width="304" height="1" border="0"><br>
<table border="0" cellspacing="0" cellpadding="0" width="675">
<tr>
</tr>
<td align="center">
<form name="form1" method="post" action="">
VER
<select name="menu1" onChange="javascript:menu()">
<option value="1">TESIS</option>
<option value="2">MEMORIAS</option>
<option value="3">LIBROS</option>
<option value="4">SERIES</option>
</select>
<label>BUSCAR
<input name="textarea" type="text" value="">
</label>
<select name="menu2" >
<option value="1">TITULO</option>
<option value="2">AUTOR</option>
<option value="3">NUMERO</option>
</select>
<label>
<input type="submit" name="Submit" value="ACTUALIZAR LISTA" onClick=scr"">
</label>
</form> </td>
<tr>
<Td>
<table width="100%" border="0">
</table>
</Td>
<?php
$db_host = 'localhost';
$db_user = 'root';
$database = 'hidrobib';
$table = 'memorias';
if (!mysql_connect($db_host, $db_user))
die("Can't connect to database");
if (!mysql_select_db($database))
die("Can't select database");
// sending query
$result = mysql_query("SELECT * FROM $table ORDER BY $table.Numero");
if (!$result) {
die("Query to show fields from table failed");
}
$fields_num = mysql_num_fields($result);
echo "<table border='3' width=100%><tr>";
// printing table headers
for($i=0; $i<$fields_num; $i++)
{
if ($i==0){
$field = mysql_fetch_field($result);
echo "<td width=10%>{$field->name}</td>";
}
else{
$field = mysql_fetch_field($result);
echo "<td>{$field->name}</td>";
}
}
echo "</tr>\n";
// printing table rows
while($row = mysql_fetch_row($result))
{
echo "<tr>";
// $row is array... foreach( .. ) puts every element
// of $row to $cell variable
foreach($row as $cell)
echo "<td>$cell</td>";
echo "</tr>\n";
}
mysql_free_result($result);
?>
</tr>
</table>
</Td></tr>
</table> </td>
</table>
<tr>
</tr>
</table>
</body>
</html> |