Ok i have coded some validation, is there a better way to do it, than put it in an if statement, so that multiple validations occour?
Here is the code:
<?php
include ("functions/customer_functions.php");
$firstname = ucwords(strtolower($firstname=$_REQUEST['firstname']));
$lastname = ucwords(strtolower($laname=$_REQUEST['lastname']));
if (ereg ("^[A-Z][a-z]+$", $firstname))
{
if (ereg ("^[A-Z][a-z]+$", $lastname))
{
cust_add($firstname, $lastname); # Adds details to db.
}
else
{
echo "\"$lastname\" - is an invalid lastname!";
}
}
else
{
echo "\"$firstname\" - is an invalid firstname!";
}
?>
is this a good way to do it?