I am working on an html form to send me data through the POST method to a file registerAcursos.php but it will not let me enter the data I get with the first sql, I get an error that could not send the data.
and look for error comparing with other files to verify the same and can not find anything.
<form class="form-horizontal form-label-left" action="registrarAcursos.php" method="POST">
<h4>Busca el Alumno</h4>
<p class="font-gray-dark">
Seleciona el alumno que quieres registrar al : <?php echo $_SESSION['nombre_c'] ?> .
</p>
<div class="col-md-8 center-margin">
<div class="form-group">
<label>Ingresa el Nombre De Usuario Del alumno que quieres ingresar</label>
<input name="usuario" type="text" class="form-control" placeholder="Enter email">
</div>
</div>
<center>
<button type="submit" class="btn btn-primary" style="margin-right: 5px;"><i class="fa fa-download"></i> Agregar Alumno</button>
</center>
<?php
$ID = $_SESSION['id_c'];
$mensaje = $_GET['msj'];
if ($mensaje == "si"){
header('Location:aggAlumnos.php') ;
}
if($mensaje == "no"){
echo "Usuario incorrecto";
}
if ($mensaje == "ya"){
echo "El usuario no existe";
}
?>
</form>
<?php
include("conexion.php");
$usuario = $_POST['usuario'];
$sql="SELECT USUARIO FROM USUARIOS WHERE USUARIO='$usuario'";
$result= $conn->query($sql);
if($result->num_rows>0){
$IDUSUARIO = $row['IDUSUARIO'];
$NOMBRE = $row['NOMBRE'];
$IDC = $_SESSION['id_c'];
$NOMBRE_C = $_SESSION['nombre_c'];
$sql2 = "INSERT INTO REGISTRO(ID_ALUMNO,NOMBRE_ALUMNO,ID_CURSO,NOMBRE_CURSO)
VALUES('$IDUSUARIO','$NOMBRE','$IDC','$NOMBRE_C')";
$result2=$conn->query($sql2);
if($result2 === TRUE){
header('Location:aggAlumnos.php?msj=si') ;
}else{
header('Location:aggAlumnos.php?msj=no') ;
}
}else{
header('Location:aggAlumnos.php?msj=ya') ;
}
?>