Foros del Web » Programando para Internet » PHP »

Desplegable dependiente

Estas en el tema de Desplegable dependiente en el foro de PHP en Foros del Web. Me gustaría crear un desplegable que dependiera del valor seleccionado en un desplegable previo. Tengo un formulario en el lateral derecho de la página web: ...
  #1 (permalink)  
Antiguo 08/10/2011, 13:08
 
Fecha de Ingreso: octubre-2011
Mensajes: 2
Antigüedad: 12 años, 6 meses
Puntos: 0
Pregunta Desplegable dependiente

Me gustaría crear un desplegable que dependiera del valor seleccionado en un desplegable previo.

Tengo un formulario en el lateral derecho de la página web: http://usedvehiclesforghana.blogspot.com/

Me gustaría que el desplegable 'Make' muestre diferentes valores en función del valor seleccionado en el desplegable 'Type of vehicle'. Muestro el detalle a continuación:

If 'Type of Vehicle' = 'Motorbike' el desplegable 'Make' debe mostrar los siguientes valores:
  • No preference
  • APRILIA
  • BENELLI
  • BETA
  • BIMOTA
  • BMW
  • BUELL
  • BULTACO
  • CAGIVA
  • DAELIM
  • DERBI
  • DUCATI
  • GAS GAS
  • GILERA
  • HARLEY DAVIDSON
  • HM
  • HONDA
  • HYOSUNG
  • ITALJET
  • KAWASAKI
  • KEEWAY
  • KTM
  • KYMCO
  • LAMBRETTA
  • MALAGUTI
  • MBK
  • METRAKIT
  • MOBILETTE
  • MOTO GUZZI
  • MV AGUSTA
  • MXONDA
  • PEUGEOT
  • PIAGGIO
  • RENAULT
  • RIEJU
  • SUZUKI
  • TRIUMPH
  • VESPA
  • VESPINO
  • YAMAHA
If 'Type of Vehicle' = 'Car' el desplegable 'Make' debe mostrar los siguientes valores:
  • No preference
  • Alfa Romeo
  • Audi
  • BMW
  • Chevrolet
  • Chrysler
  • Citröen
  • Daewoo
  • Daimler
  • Dodge
  • Ford
  • GM
  • Honda
  • Hyundai
  • Isuzu
  • Lexus
  • Mazda
  • Mercedes-Benz
  • MG
  • Mini
  • Mitsubishi
  • Nissan
  • Peugeot
  • Renault
  • Saab
  • Seat
  • Skoda
  • Subaru
  • Suzuki
  • Toyota
  • Volkswagen
  • Volvo
If 'Type of Vehicle' = 'Truck' el desplegable 'Make' debe mostrar los siguientes valores:
  • No prference
  • Citröen
  • DAF
  • Fiat
  • Ford
  • Hyundai
  • Isuzu
  • Iveco
  • MAN
  • Mazda
  • Mercedes-Benz
  • Mitsubishi
  • Nissan
  • Opel
  • Peugeot
  • Renault
  • Scania
  • Volkswagen
  • Volvo

Más abajo muestro el código usado en la web, ¿podéis ayudarme? Muchas gracias por adelantado, Alexander

Código web:

<!-- Begin myContactForm.com Form HTML -->
<form name="contactForm" method="post" action="http://www.mycontactform.com/sendform/sendform.php">
<input name="user" type="hidden" id="user" value="usedcars" /><input name="formid" type="hidden" id="formid" value="349649" /><input name="subject" type="hidden" id="subject" value="Request: Cars for Ghana" />
<table width="100%" style="border: 0px solid #000000; margin: 0; padding: 0; background-color: #FFFFFF;"><tr><td>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr bgcolor="#EFEFEF"><td><font color="#000000" size="2" face="Arial">Treatment</font></td><td><font color="#000000" size="2" face="Arial"><input name="q[1]" type="text" value="Mr/Mrs" size="20" maxlength="" /></font></td></tr><tr bgcolor="#FFFFFF"><td><font color="#000000" size="2" face="Arial">Name<font color="#FF0000"> *</font></font></td><td><font color="#000000" size="2" face="Arial"><input name="q[2]" type="text" value="" size="20" maxlength="" /></font></td></tr><tr bgcolor="#EFEFEF"><td><font color="#000000" size="2" face="Arial">Surename</font></td><td><font color="#000000" size="2" face="Arial"><input name="q[3]" type="text" value="" size="20" maxlength="" /></font></td></tr><tr bgcolor="#FFFFFF"><td><font color="#000000" size="2" face="Arial"> E-mail Address:<font color="#FF0000"> *</font></font></td><td><input name="email" type="text" id="email" size="20" maxlength="100" /></td></tr><tr bgcolor="#EFEFEF"><td><font color="#000000" size="2" face="Arial">Type of vehicle</font></td><td><font color="#000000" size="2" face="Arial"><select name="q[9]" ><option value="Motorbike" />Motorbike<option value="Car" />Car<option value="Truck" />Truck<option value="Other" />Other</select></font></td></tr><tr bgcolor="#FFFFFF"><td><font color="#000000" size="2" face="Arial">Make</font></td><td><font color="#000000" size="2" face="Arial"><select name="q[4]" ><option value="No preference" />No preference<option value="Alfa Romeo" />Alfa Romeo<option value="Audi" />Audi<option value="BMW" />BMW<option value="Chevrolet" />Chevrolet<option value="Chrysler" />Chrysler<option value="Citröen" />Citröen<option value="Daewoo" />Daewoo<option value="Daimler" />Daimler<option value="Dodge" />Dodge<option value="Ford" />Ford<option value="GM" />GM<option value="Honda" />Honda<option value="Hyundai" />Hyundai<option value="Isuzu" />Isuzu<option value="Lexus" />Lexus<option value="Mazda" />Mazda<option value="Mercedes-Benz" />Mercedes-Benz<option value="MG" />MG<option value="Mini" />Mini<option value="Mitsubishi" />Mitsubishi<option value="Nissan" />Nissan<option value="Opel" />Opel<option value="Peugeot" />Peugeot<option value="Renault" />Renault<option value="Saab" />Saab<option value="Seat" />Seat<option value="Skoda" />Skoda<option value="Subaru" />Subaru<option value="Suzuki" />Suzuki<option value="Toyota" />Toyota<option value="Volkswagen" />Volkswagen<option value="Volvo" />Volvo</select></font></td></tr><tr bgcolor="#EFEFEF"><td><font color="#000000" size="2" face="Arial">Model</font></td><td><font color="#000000" size="2" face="Arial"><input name="q[5]" type="text" value="" size="20" maxlength="" /></font></td></tr><tr bgcolor="#FFFFFF"><td><font color="#000000" size="2" face="Arial">Manufacture Year</font></td><td><font color="#000000" size="2" face="Arial"><select name="q[6]" ><option value="2011" />2011<option value="2010" />2010<option value="2009" />2009<option value="2008" />2008<option value="2007" />2007<option value="2006" />2006<option value="2005" />2005<option value="2004" />2004<option value="2003" />2003<option value="2002" />2002</select></font></td></tr><tr bgcolor="#EFEFEF"><td><font color="#000000" size="2" face="Arial">Mileage</font></td><td><font color="#000000" size="2" face="Arial"><select name="q[7]" ><option value="No preference" />No preference<option value="0-10,000km" />0-10,000km<option value="10,001-50,000km" />10,001-50,000km<option value="50,001-100,000km" />50,001-100,000km<option value="100,001-200,000km" />100,001-200,000km<option value="200,000-500,000km" />200,000-500,000km</select></font></td></tr><tr bgcolor="#FFFFFF"><td><font color="#000000" size="2" face="Arial">Comments</font></td><td><font color="#000000" size="2" face="Arial"><textarea name="q[8]" cols="20" rows="10" ></textarea></font></td></tr><tr><td colspan="2"><hr size="1" /></td></tr>
<tr><td colspan="2"><input name="submit" type="submit" value="Submit" /> <input name="reset" type="reset" value="Reset" /> <input type="button" value="Print" onclick="window.print()" /> </td></tr>
<tr><td><font color="#FF0000" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>*</b></font> <font size="1" face="Verdana, Arial, Helvetica, sans-serif">Required</font></td><td align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><a href="http://www.mycontactform.com"><strong>Create Email Forms</strong></a></font></td></tr>
</table></td></tr></table></form>
<!-- End myContactForm.com Form HTML -->
  #2 (permalink)  
Antiguo 08/10/2011, 13:19
 
Fecha de Ingreso: diciembre-2006
Ubicación: Peruvian
Mensajes: 142
Antigüedad: 17 años, 4 meses
Puntos: 7
Respuesta: Desplegable dependiente

Uiza esto te ayude .
http://www.formatoweb.com.ar/ajax/se...pendientes.php
saludos!!
  #3 (permalink)  
Antiguo 08/10/2011, 13:27
Avatar de skiper0125  
Fecha de Ingreso: octubre-2010
Ubicación: $this->Mexico('Toluca');
Mensajes: 1.127
Antigüedad: 13 años, 6 meses
Puntos: 511
Respuesta: Desplegable dependiente

Hola que tal.

si te entendi bien lo que necesitas es select dependientes verdad y eso lo puedes hacer mas facilmente con ajax checa esto

saludos
__________________
Recuerda que estamos aquí para orientarte, y no para hacer tu trabajo.
Si mi aporte fue de ayuda, recuerda que agradecer no cuesta nada +1

Skiper0125
  #4 (permalink)  
Antiguo 08/10/2011, 13:45
 
Fecha de Ingreso: octubre-2011
Mensajes: 2
Antigüedad: 12 años, 6 meses
Puntos: 0
Respuesta: Desplegable dependiente

Sólo se puede hacer con código php?
He visto el código de ejemplo expuesto por Daniel (http://www.formatoweb.com.ar/blog/2007/08/20/clase-para-generar-automaticamente-select-combos-dependientes-multinivel/), no estoy nada familiarizado con php y me cuesta entenderlo. Me he bajado el xamp para poder operar con el fichero php y ver los resultados, pero me indica 'No database selected'.

Hablaré directamente con Daniel.
Muchas gracias,
Alex

Etiquetas: dependiente, desplegable, html
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 02:46.