Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/01/2013, 09:06
emmaghost
 
Fecha de Ingreso: enero-2013
Mensajes: 68
Antigüedad: 11 años, 3 meses
Puntos: 0
Mensaje Select dependientes problemas

Hola buen dia tengo unos problemas con unos select dependientes no logro hacer que funcionen espero me ayuden y también quiero hacer que al seleccionar el 2 combo me traiga en un tetarea una info de la base de datos pero nose como hacer espero me puedan orientar o ayudar a realizarlo de antemano gracias

comprarto mi codigo es en un solo php

************************************************** ************************************************** **********************************
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>segunda pantalla</title>
<script language="javascript" src="js/jquery-1.2.6.min.js"></script>
<script language="javascript">
</script>
<script>
function valida(cantidad1,cantidad2,cantidad3) {
var total;
var uno;
var dos;
var tres;
if (cantidad1.value == ""){
uno = 0;}
else{
uno = cantidad1.value ;
}

if (cantidad2.value == ""){
dos = 0;}
else{
dos = cantidad2.value;
}

if (cantidad3.value == ""){
tres = 0;}
else{
tres = cantidad3.value ;
}
total = parseInt(uno)+parseInt(dos)+parseInt(tres);
if (total == 0){
alert("Llene como minimo un precio");}
else{

document.formulario.sumaTotal.value=total;
alert("El valor es " + total); }
}
function Mostrar(formulario) {
formulario.sw_esta_2.value = 1;
formulario.submit();
}
function Mueve(formulario) {
formulario.sw_esta_2.value = 2;
formulario.submit();
}


var no_digito = /\D/g;

function test (){
}

</script>
</head>
<body>
<h2>2 pantalla</h2>
<div align="center">
<form name="formulario" id="formulario" method="POST">

<tr>

<textarea name="myTextArea"cols="20" rows="10"></textarea><br />
</dt>
<dt>
</tr>
<table>
<tr>
<th scope="col">Precio</th>
<th scope="col">Precio</th>
<th scope="col">Precio</th>
</tr>
<tr>
<td><input type=text STYLE="text-align:center" onkeyup="this.value = this.value.replace(no_digito, '')" name ="cantidad1" /></td>
<td><input type=text STYLE="text-align:center" onkeyup="this.value = this.value.replace(no_digito, '')" name ="cantidad2" /></td>
<td><input type=text STYLE="text-align:center" onkeyup="this.value = this.value.replace(no_digito, '')" name ="cantidad3"/></td>
</tr>
</table>
<table>
<tr>
<th scope="col">Total</th>
</tr>
<tr>
<td><input type="text" STYLE="text-align:center" name="sumaTotal" size="25" value=""></td>
<input type="button" name="Ver total" value="Ver total" onclick="valida(cantidad1,cantidad2,cantidad3)">
<input type="reset" name="Limpiar" tabindex="6" value="Limpiar" /></dt>
</tr>
</table>


<br />


</form>
<form name="formulario" id="formulario" method="POST">
Codigo: <select name="codigo" class="combo" onChange="Mueve(this.form);">
<?PHP
include_once("conexion.php");
$result = mysql_query("SELECT id,opcion, relacion FROM lista_paises ORDER BY opcion");
while ($row=mysql_fetch_array($result)) {
if ($sw_esta_1=="") {
$estado = $row[id];
$sw_esta_1 = 1;
}
if ($estado==$row[id]) {
echo ("<OPTION VALUE=".$row[id]." SELECTED>".$row[opcion]."n");
}
else {
echo ("<OPTION VALUE=".$row[id].">".$row[opcion]."n");

}
}
?>
</select>
<br />
Descripcion: <select name="descripcion" class="combo">
<?PHP
include_once("conexion.php");
$result = mysql_query("SSELECT id,opcion, relacion FROM lista_estados WHERE id = '$codigo'");
while ($row=mysql_fetch_array($result))
{
if ($ciudad==$row[id]) {
echo ("<OPTION VALUE=".$row[id]." SELECTED>".$row[opcion]."n");
}
else {
echo ("<OPTION VALUE=".$row[id].">".$row[opcion]."n");
}
}

mysql_close();
?>
</select>
<br />
<input type="button" name="Boton1" value="Grabar" OnClick="Mostrar(this.form);">
<input type="hidden" name="sw_esta_2" value="1">
</form>
<br />

</div>
</body>
</html>

Última edición por emmaghost; 25/01/2013 a las 12:01