Hello all,
I have a set of IF ELSE validation code ECHOING onto a php web page through a SWITCH staement. Everything works fine all error messages show up correctly. The problem is, after going through 3 conditons it starts to allow entry into my DB(mysql) all other entries goes straight through and stops validating.
if (empty($_POST[model]))
{
header("Location: " . $config_basedir . "/newcar.php?error=model");
}
if (empty($_POST[engine]))
{
header("Location: " . $config_basedir . "/newcar.php?error=engine");
}
if (empty($_POST[colour]))
{
header("Location: " . $config_basedir . "/newcar.php?error=colour");
}
else {
header("Location: " . $config_basedir . "/newcar.php?error=date");
}
}
else {
require("header.php");
?>
<?php
switch($_GET['error']) {
case "date":
echo "<strong>Invalid date - please enter another!</strong>";
break;
case "model":
echo "<strong>Please provide the vehicle model!</strong>";
break;
case "engine":
echo "<strong>Please provide engine type!</strong>";
break;
case "colour":
echo "<strong>Please provide colour of vehicle!</strong>";
break;
}
}
?>
Can someone help please it would be much appreciated, this has never happened to me before. is it common?
Thanks