husarnegro Posted February 28, 2016 Report Share Posted February 28, 2016 Hola, mi prgunta es somo hacer para que cada vez que se ingrese un nuevo producto mediante el formulario, este sea guardado y posteriormente visualizado desde un select que consulta a la base de datos (especificamente el nombre) <form id="form1" name="form1" method="post" action="fproducto.php"> <table width="400" border="1"> <tr> <td width="120">Nombre</td> <td width="270"><label for="nombre"></label> <input type="text" name="nombre" id="nombre" /></td> </tr> <tr> <td>Dosificacion</td> <td><label for="dosificacion"></label> <input type="text" name="dosificacion" id="dosificacion" /></td> </tr> <tr> <td>Marca</td> <td><label for="marca"></label> <input type="text" name="marca" id="marca" /></td> </tr> <tr> <td>Descripcion</td> <td><label for="descripcion"></label> <textarea name="descripcion" id="descripcion" cols="45" rows="5"></textarea></td> </tr> <tr> <td> </td> <td><input type="reset" name="button" id="button" value="Limpiar" /> <input type="submit" name="button2" id="button2" value="Enviar" /></td> </tr> </table> </form> Me refiero a que pueda ser visualizado cuando consulto desde otro formulario, de esta forma: <?php $sql4=mysql_query("SELECT nombre FROM producto ORDER BY Nombre ASC ",$con); ?> <select name="lista" onchange="pedirDatos()" > <?php while($row = mysql_fetch_array($sql4)){ echo "<option value=\"".$row['nombre']."\">".$row['nombre']."</option> \n"; } ?> </select> Link to comment Share on other sites More sharing options...
cañangasñangas Posted February 28, 2016 Report Share Posted February 28, 2016 No entendí lo que deseas, ¿Quieres que ese select se "autollene" una ves ingresado el formulario?y te recomiendo cambiar echo "<option value=\"".$row['nombre']."\">".$row['nombre']."</option> \n"; por echo '<option value="'.$row["nombre"].'">'.$row["nombre"].'</option>'; para que no tengas que escapar tantas comillas y no necesitas ese salto de linea... Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now