Buenas noches llegue a esta comunidad pidiendo ayuda, les explico brevemente, en un proyecto personal tengo varias tablas, 2 de ellas se llaman:
Docentes, con los campos
id
nombre
ape_pat
ape_mal
fecha
email
password
Cursos, con los campos
id
nombre
descripcion
fecha_inicio
fecha_final
horas_totales
docente
Las tablas estan en la misma base de datos, al momento de agregar un nuevo curso , se cargan todos los docentes en un select, pero cuando lo envio para que guarde la opcion no llegan los datos, les dejo los formularios para ver si me pueden hechar la mano.
<!---Agregar Curso--->
<h4>Registrar Curso</h4>
<form name="registro" action="agregar_curso.php" method="POST">
<table width="100%">
<tbody>
<tr>
<td width="15%">Nombre:</td>
<td><input type="text" size="100" name="nombre" onKeyDown="return letras(event)" required="required"/></td>
</tr>
<tr>
<td width="15%">Descripcion:</td>
<td><textarea name="descripcion" cols="50" rows="10"required="required"></textarea></td>
</tr>
<tr>
<td width="15%">Fecha de Inicio:</td>
<td><input type="date" name="fecha_inicio" required="required"></td>
</tr>
<tr>
<td width="15%">Fecha de Terminacion:</td>
<td><input type="date" name="fecha_final" required="required"></td>
</tr>
<tr>
<td width="15%">Horas total del curso:</td>
<td><input type="text" name="horas" onkeypress="javascript:return validarNro(event)" required="required"></td>
</tr>
<tr>
<td width="15%">Docente:</td>
<div class="custom dropdown">
<form class="custom"></form>
</div>
<td>
<form class="custom">
<select id="customDropdown">
<?php
while ( $row = mysql_fetch_array($result) )
{
?>
<option value=" <?php echo $row['nombre']; ?> " >
<?php echo $row['nombre']; ?>
</option>
<?php
}
?>
</select>
</form>
</td>
</tr>
</tbody>
</table>
<center>
<input class="button" name="registrar" type="submit" value="Registrar"/>
</center>
</form></center>
</div>
</div>
<!---Agregar curso--->
<?php
//recibimos los datos
$nombre = $_POST['nombre'];
$descripcion = $_POST['descripcion'];
$fecha_inicio = $_POST['fecha_inicio'];
$fecha_final = $_POST['fecha_final'];
$horas = $_POST['horas'];
$docente = $_POST['docente'];
//verificamos que sea pulsado el boton registrar
if (isset($_POST['registrar'])) {
//INSERTAMOS LOS DATOS
$query="INSERT INTO cursos VALUES(null,'". $nombre ."','". $descripcion ."','". $fecha_inicio ."','". $fecha_final ."','". $horas ."', '". $docente ."');";
mysql_query($query);
//CERRAMOS LA CONEXION
include 'close_connection.php';
}
}
else
{
//no se presiono el boton registrar
header("location: no se preciono_boton.php");
}
?>