Ver Mensaje Individual
  #2 (permalink)  
Antiguo 21/11/2011, 16:14
jossss
 
Fecha de Ingreso: mayo-2006
Mensajes: 475
Antigüedad: 18 años, 9 meses
Puntos: 58
Respuesta: Select en php + mysql

Prueba asi
Código PHP:
<?php
require ("conexion.php");
$grado=$_REQUEST["grado"];
$cantidad=$_POST["c_materias"];
$consul_docente="SELECT * FROM docente";
$query=mysql_query($consul_docente,$con);
if(
mysql_num_rows($query)==0)
echo 
"Inserte Docentes";

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Nombre de Materias</title>
</head>
<body>
<h1 align="center">Nombre de Materias
</h1>
<p align="right"><a href="menu.php">Regresar al Menu</a> - <a href="cantidad_materia.php">Atras</a> - Salir</p>
<p align="center"><strong>Agregar Materias al grado:</strong> <?php echo $grado?> </p>
<form id="form1" name="form1" method="post" action="insertar_materia_nueva.php?curso=<?php echo $grado?>">
  <table width="90%" border="0" align="center">
   <?php
for($i=0;$i<$cantidad;$i++)
{
?>
    <tr>
      <td width="46%"><div align="right"><strong>Nombre:</strong></div></td>
      <td width="54%"><input type="text" name="nom_materia" id="nom_materia" /></td>
    </tr>
    <tr>
      <td><div align="right"><strong>Docente:</strong></div></td>
      <td>
      <select name="docente" id="docente">
        <option >Seleccione Docente</option>
<?php
$consul_docente
="SELECT * FROM docente";
$query=mysql_query($consul_docente,$con);
 while (
$fila=mysql_fetch_array($query)){
echo 
"<option value='" .$fila['cedula'] ."'>" .$fila['nombre'] . " "$fila['apellido'] ." </option>";
 }
?>
      </select>
      <?php
}
      
mysql_close($con);
      
?>
      </td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input type="submit" name="button" id="button" value="Enviar" /></td>
    </tr>
  </table>

</form>
<p align="center">&nbsp;</p>
</body>
</html>