[SOLVED] Validation help
Posted: Wed Aug 11, 2004 5:41 am
Code: Select all
<div class="header">Hosting Order Form</div>
<div class="storycontent">
<?php
//Perform Form Validation Here
if (!$name || !$country || !$email || !$plan || !$frontpage || !$domain || !$username || !$pwd ||
!$pwd2 || !$payment || !$term || !$paypalmail)
{
echo "You didn't fill in all the required fields. Go back.";
}
else {
//do email format validation
if(!eregi('^([._a-z0-9-]+[._a-z0-9-]*)@(([a-z0-9-]+\.)*([a-z0-9-]+)(\.[a-z]{2,3})?)$', $email))
{
echo "This is not a valid email address. Go back";
}
else {
//do password validation
if ($pwd != $pwd2)
{
echo "Your password didn''t match. Go back";
exit;
}
// Ok, now send email
$myemail = "removed";
$headers = "From: "$name" <$email>\n";
$message = "
Full Name: $name
Country: $country
Email: $email
Hosting Plan: $plan
Frontpage Extension: $frontpage
Domain name: $domain
Username: $username
Password: $pwd
Payment Method: $payment
Term of Payment: $term
Paypal Email: $paypalmail
";
mail("$myemail", "Decorum Hosting Order Form", $message, $headers);
echo "Thank you <b>$name</b>, your order has been sent. <br />
<br />
Your order will be processed within 24 hours. <br />
Billing information will be sent to your email address (<b>$email</b>) where you can make payment for your account. <br />
Upon receiving payment your account access information will be emailed directly to you.";
}
?>
</div>The form validation works well if I comment away the
Code: Select all
}
else {
//do password validation
if ($pwd != $pwd2)
{
echo "Your password didn''t match. Go back";Its seems like this is messing up my validation.
I was woundering if anyone out there could help me with a solution on how to make it check that $pwd and $pwd2 are equal (I ask the users to type his password twice for validation and to prevent misspelling of the password
Thanks for you help on advance =)