Code: Select all
<?php
if (empty($_POST['user']))
{
$_SESSION['msg'] = 'Username is empty.';
header('location: ' . request . '/index.php');
}
if (empty($_POST['pass']))
{
$_SESSION['msg'] = 'Password is empty.';
header('location: ' . request . '/index.php');
}
echo 'You should never see this if one of your fields is empty.';
?>On my another script (the one which I am actually working on atm) it's even more weird, because there, even if both fields are submitted empty, it executes the code below the two if statements, as if they didn't exist.
Btw, if I used else, then it would work just as expected.
Code: Select all
<?php
if (empty($_POST['user']))
{
$_SESSION['msg'] = 'Username is empty.';
header('location: ' . request . '/index.php');
} else
if (empty($_POST['pass']))
{
$_SESSION['msg'] = 'Password is empty.';
header('location: ' . request . '/index.php');
} else
{
echo 'You should never see this if one of your fields is empty.';
}
?>