Instead of using this code
//check that the form fields are not empty, and redirect back to the login page if they are
elseif (empty($_POST['myusername']) || empty($_POST['mypassword'])) {
header( "location:http://www.mysite.com/login.html" );
}
try this one to avoid redirect page
<?php
if(isset($_POST['submitbutton'])){
//check that the form fields are not empty, and redirect back to the login page if they are
if (empty($_POST['myusername']) || empty($_POST['mypassword'])) {
$msg = "Empty field found!";
}else{
//your code goes here
}
}
?>
<form method="POST">
<table>
<tr>
<td>
<?php
if(isset($_POST['yourSUBMITbutton'])) {
echo $msg;
}
?>
</td>
</tr>
<tr>
<td>YOUR DESIGN GOES HERE..</td>
</tr>
</table>
</form>