Código :
<?php include 'conexion.php'; $con=conexion(); $res=mysql_query("select * from transporte",$con); ?> <html> <body> <script type="text/javascript"> function validar(form) { if (form.txt1.value <=4){ form.txt2.disabled=(form.txt1.value==''); form.casilla[0].disabled=(form.txt1.value==''); } else { form.casilla[1].disabled=(form.txt1.value==''); } } </script> <form method="post" action="eliminar.php"> <form> <input type="text" name="txt1" onKeyUp="validar(this.form)" /> <input type="text" name="txt2" disabled /> <table border="1"> <tr> <th></th> <th>Nombre</th> </tr> <?php while($fila=mysql_fetch_array($res)){ ?> <tr> <th><input type="radio" name="casilla[]" value="<?php echo $fila["id_transporte"]; ?>" disabled></th> <th><?php echo $fila["descripcion"]; ?></th> </tr> <?php } ?> </table> </form> </body> </html>
este código si me funciona pero la diferencia es que los radios button no son cargados de una base de datos.
Código PHP :
html> <head> <script type="text/javascript"> function validar(form) { if (form.txt1.value <=4){ form.r2.disabled=(form.txt1.value==''); form.txt2.disabled=(form.txt1.value==''); } else { form.r1.disabled=(form.txt1.value==''); } } </script> </head> <body> <form> <input type="text" name="txt1" onKeyUp="validar(this.form)" /> <input name="r2" type="radio" value="" disabled> <input name="r1" type="radio" value="" disabled> <input type="text" name="txt2" disabled /> </form> </body> </html>