Im trying to validate a single textbox on the same page using PHP but am unable to get the errors to show. When i click submit and there is nothing in the textbox it works by not letting it go to the next page but it does not show the errors. Here is my code.
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($_POST['IGN'] == ""){
$errors="Please enter a IGN";
}
if (isset($errors)){
echo $errors;
}
}
?>
<form method="post" action="Queston1.php">
<label for="IGN" class="questionText">IGN (In Game Name)</label><br />
<input type="text" name="IGN" /><br />
<input type="submit" name="start" value="start" />
</form>
I have tried it with and without the if (isset($errors))
to see if that was the problem but both times i get the same result.
Can anyone see or know how to fix this?