El codigo que tengo es el siguiente:
Archivo f_agregaequipo.php
php
<?php include "Conexion.php"; ?> <html> <head><title>SISTEMA DE INVENTARIO</title> <script type="text/javascript" language="javascript" src="funciones.js"></script> </head> <body onload="limpiar()"> <center> <h1><font color="green">Recepcion de Equipo</font></h1> <hr /> <form name="f_agregaequipo" method='post' action="agregaequipo.php"> <table border="10"> <tr> </tr><tr> <td>Fabricante:</td> <td> <div id="fabricante"> <select name="fabricante" onchange="from(document.f_agregaequipo.fabricante.value,'producto','combproducto.php')"> <option selected disabled> </option> <?php $sql="select * from t_fabricante order by fabricante asc"; { ?> <option value="<?php echo $reg["cod_fabricante"];?>"><?php echo $reg["fabricante"];?></option> <?php } ?> </select> </div> </td> </tr><tr> <td>Producto:</td> <td> <div id="producto"> <select name="producto"> <option selected disabled> </option> </select> </div> </td> </tr><tr> <td>Modelo:</td> <td> <div id="modelo"> <select name="modelo"> <option selected disabled> </option> </select> </div> </td> </tr><tr> <td>Serial:</td> <td> <input type="text" name="serial" size="30" maxlength="30" /> </td> </tr><tr> <td>Ubication:</td> <td> <input type="text" name="ubicacion" size="30" maxlength="30" /> </td> </tr><tr> <td>Rack:</td> <td> <input type="text" name="rack" size="30" maxlength="30" /> </td> </tr><tr> <td>Bin:</td> <td> <input type="text" name="bin" size="30" maxlength="30" /> </td> </tr><tr> <td> <input Disabled name="fecha" value="<?php echo date("m/d/Y H:i:s"); ?>" size="15" /> </td> </tr><tr> <td><input type="submit" value="Enviar"/></td> <td><input type ="reset" value = "reetablecer"> </td> </tr> </table> </form> </center> <br /><hr /> </body> </html>
Archivo combproducto.php
php
<?php include "Conexion.php"; $sql="select * from t_producto where cod_fabricante=".$_POST["id"].""; ?> <select name="producto" onchange="from(document.f_agregaequipo.producto.value,'modelo','combmodelo.php')"> <option selected disabled> </option> <?php { ?> <option value="<?php echo $reg["cod_producto"];?>"><?php echo $reg["producto"];?></option> <?php } ?> </select>
Archivo combmodelo.php
php
<?php include "Conexion.php"; $sql="select * from t_modelo where cod_producto=".$_POST["id"].""; ?> <select name="modelo"> <option selected disabled> </option> <?php { ?> <option value="<?php echo $reg["cod_modelo"];?>"><?php echo $reg["modelo"];?></option> <?php } ?> </select> [/Code ] [color=green][b]Archivo agregaequipo.php[/b][/color] [code=PHP] <?php // Se establece la conexión con la fuente de datos // Si no hay conexión, se emite un error y se aborta if (!$con) // Utilizamos el codigo del Fabricante tomado del select y los utilizamos para buscar el nombre del fabricante. $cod_fabricante = $_POST["fabricante"]; $sql = "SELECT fabricante FROM t_fabricante WHERE cod_fabricante = $cod_fabricante"; $fabricante = $reg["fabricante"]; } // Utilizamos el codigo del Producto tomado del select y los utilizamos para buscar el nombre del Producto. $cod_producto = $_POST["producto"]; $sql = "SELECT producto FROM t_producto WHERE cod_producto = $cod_producto"; $producto = $reg["producto"]; } // Utilizamos el codigo del Modelo tomado del select y los utilizamos para buscar el nombre del Modelo. $cod_modelo = $_POST["modelo"]; $sql = "SELECT modelo FROM t_modelo WHERE cod_modelo = $cod_modelo"; $modelo = $reg["modelo"]; } $insertar ="INSERT INTO t_agregaequipo VALUES ('$fabricante','$producto','$modelo','$_POST[serial]','$_POST[ubicacion]','$_POST[rack]','$_POST[bin]','$_POST[fecha]')"; // Se solicita la ejecución de la nueva instrucción (Insert) // Se cierra la conexión require('f_agregaequipo.php'); ?> [/code] [color=green][b]Y por ultimo el archivo funciones.js que me esta dando un error en la linea 34 donde esta: var vinculo=url El codigo es el siguiente:[/b][/color] [code=Java] function obtiene_http_request() { var req = false; try { req = new XMLHttpRequest(); /* p.e. Firefox */ } catch(err1) { try { req = new ActiveXObject("Msxml2.XMLHTTP"); /* algunas versiones IE */ } catch(err2) { try { req = new ActiveXObject("Microsoft.XMLHTTP"); /* algunas versiones IE */ } catch(err3) { req = false; } } } return req; } var miPeticion = obtiene_http_request(); //*************************************************************************************** function from(id,ide,url){ var mi_aleatorio=parseInt(Math.random()*99999999);//para que no guarde la página en el caché... var vinculo=url "?id=" id "&rand=" mi_aleatorio; //alert(vinculo); miPeticion.open("GET",vinculo,true);//ponemos true para que la petición sea asincrónica miPeticion.onreadystatechange=miPeticion.onreadystatechange=function(){ if (miPeticion.readyState==4) { //alert(miPeticion.readyState); if (miPeticion.status==200) { //alert(miPeticion.status); //var http=miPeticion.responseXML; var http=miPeticion.responseText; document.getElementById(ide).innerHTML= http; } }/*else { document.getElementById(ide).innerHTML="<img src='ima/loading.gif' title='cargando...' />"; }*/ } miPeticion.send(null); } //************************************************************************************************ function limpiar() { }