tengo un form, con un <select>, lo que yo quisiera hacer es que cuando escojo una opcion del select, el input type que esta a la derecha cambie, y para esto necesito que cada vez que cambio de opcion (select), el valor sea enviado (como si hubiera dado click en el boton "envia");
La idea es esta (ambos hacen lo mismo, solo que la segunda opcion me vino en mente mientras escribia el post), todos los a href de la segunda opcion no son correctos, pero la cosa principal es como enviar el valor del selec simplemente al escogerlo:
Código:
o sino:<form method= "post" action="mismapagina.php"> Tramite:<select size="1" name="modo"> <option value="ids">IDS</option> <option value="nomcog">Nome e Cognome</option> <option value="cognome">Cognome</option> <option value="citta">Citta</option> <option value="cap">CAP</option> <option value="annonascita">Anno di nascita</option> <option value="datanascita">Data di nascita</option> </select> <?php $modo=$_POST["modo"]; switch($modo) { case "ids": echo "<input type='text' size='3' maxlength='5' name='ids' />"; break; case "nomcog": echo "Nome: <input type='text' size='30' maxlength='30' name='nome' /> Cognome: <input type='text' size='30' maxlength='30' name='cognomr'"; break; case "cognome": echo "<input type='text' size='30' maxlength='30' name='cognomr' />"; exit(); case "citta": <input type='text' size='15' maxlength='15' name='citta' />; exit(); case "cap": <input type='text' size='5' maxlength='5' name='cap' />; exit(); case "annonascita": <input type='text' size='4' maxlength='4' name='aaaa' title='aaaa' /> exit(); case "datanascita": <input type='text' size='2' maxlength='2' name='gg' title='gg' /><input type='text' size='2' maxlength='2' name='mm' title='mm' /><input type='text' size='4' maxlength='4' name='aaaa' title='aaaa' /> exit(); } ?> <br /><br /> <input type="submit" name="invia" value="Invia" /> <input type="reset" value="Annulla" /> <a href="index.html" style=" text-decoration: none;"><input type="button" value="Torna al menu"/></a> </form> <?php $invia=$_POST["invia"]; if($invia=="Invia") { switch($modo) { case "ids": header('Location: stids.php'); break; case "nomcog": header('Location: stnomcog.php'); break; case "cognome": header('Location: stcognome.php'); exit(); case "citta": header('Location: stcitta.php'); exit(); case "cap": header('Location: stcap.php'); exit(); case "annonascita": header('Location: stannona.php'); exit(); case "datanascita": header('Location: stdatana.php'); exit(); } } ?>
Código:
<form method= "post" action="mismapagina.php"> Tramite:<select size="1" name="modo"> <option value="ids">IDS</option> <option value="nomcog">Nome e Cognome</option> <option value="cognome">Cognome</option> <option value="citta">Citta</option> <option value="cap">CAP</option> <option value="annonascita">Anno di nascita</option> <option value="datanascita">Data di nascita</option> </select> <?php $modo=$_POST["modo"]; switch($modo) { case "ids": echo "<input type='text' size='3' maxlength='5' name='ids' /> \n\n<a href="stids.php" style=" text-decoration: none;"><input type="button" value="Cerca"/></a>"; break; case "nomcog": echo "Nome: <input type='text' size='30' maxlength='30' name='nome' /> Cognome: <input type='text' size='30' maxlength='30' name='cognomr' />\n\n<a href="stnomcog.php" style=" text-decoration: none;"><input type="button" value="Cerca"/></a>"; break; case "cognome": echo "<input type='text' size='30' maxlength='30' name='cognomr'/>\n\n<a href="index.html" style=" text-decoration: none;"><input type="button" value="Cerca"/></a>"; exit(); case "citta": echo "<input type='text' size='15' maxlength='15' name='citta' />\n\n<a href="index.html" style=" text-decoration: none;"><input type="button" value="Cerca"/></a>"; exit(); case "cap": echo "<input type='text' size='5' maxlength='5' name='cap' />\n\n<a href="index.html" style=" text-decoration: none;"><input type="button" value="Cerca"/></a>"; exit(); case "annonascita": echo "<input type='text' size='4' maxlength='4' name='aaaa' title='aaaa' />\n\n<a href="index.html" style=" text-decoration: none;"><input type="button" value="Cerca"/></a>"; exit(); case "datanascita": echo "<input type='text' size='2' maxlength='2' name='gg' title='gg' /><input type='text' size='2' maxlength='2' name='mm' title='mm' /><input type='text' size='4' maxlength='4' name='aaaa' title='aaaa' />\n\n<a href="index.html" style=" text-decoration: none;"><input type="button" value="Cerca"/></a>"; exit(); } ?> </form>
Gracias de antemano...