Adding error message to form
Posted: Tue May 26, 2009 1:17 pm
Hey,
I have a registration form and I can't get error messages to show on the same page as the form. Errors such as 'first name empty' when the field is blank.
I have codes such as:
Which writes the error in the page as if the page loads up to the error message, then stops loading and it looks very ugly.
I have tried changing the code in the 2 following ways:
When doing both codes its as if the form then ignores the error's and just inserts them into the database as they are...
Can anyone see where I am going wrong?
I have a registration form and I can't get error messages to show on the same page as the form. Errors such as 'first name empty' when the field is blank.
I have codes such as:
Code: Select all
if (strlen($_POST['name']) < 5)
{
die ("Incorrect email. Please enter valid email address..");
}I have tried changing the code in the 2 following ways:
Code: Select all
if (strlen($_POST['name']) < 5)
{
echo ("Incorrect email. Please enter valid email address..");
}Code: Select all
if (strlen($_POST['name']) < 5)
{
$error = "Incorrect email. Please enter valid email address..";
}
echo ("$error");Can anyone see where I am going wrong?