I already have my index in which I log in with username and password, the question is that when giving blank space in both fields allows entering the menu, some sentence in script or php to validate and prevent this happen?
form code:
<center><form name='login' class="register" method='post' action='login.php'>
<tr>
<td><label>Usuario:</td>
</tr>
<tr>
<td><input type='text' class="register-input" required name='Usuario' maxlenght='10'></label></td>
</tr>
<tr>
<td><label>Clave/RP:</td>
</tr>
<tr>
<td><input type='password' class="register-input" required name='RPE'></label><br><br></td>
</tr>
<tr>
<td><center><input type='submit' class="register-button" id='boton' value='Iniciar sesión'></label></center></td>
</tr>
</form></center>
login.php code
<div class="menu" id=registro>
<?php session_start();
$Usuario=$_POST['Usuario'];
$RPE=$_POST['RPE'];
$query = "SELECT idAdmin, Usuario FROM administradores WHERE
Usuario='$Usuario' AND RPE='$RPE'";
include('libreria.php');
$result=conectar_bd($query);
if ($row = mysqli_fetch_array($result))
{
$_SESSION['idAdmin']=$row[0];
$_SESSION['Usuario']=$row[1];
header ("Location: menu.php");
}
else
{
echo "<center>ERROR: No existe el usuario o la clave es incorrecta. <br><br></center>";
echo "<center><a href='index.php'>INTENTAR DE NUEVO</a><br>
</center>";
}
?>
<center><img src="images/error.png" width="350" height="250" alt="Logo
CFE"/</center>
</div>