Need help with complex server side validation on email form
Posted: Tue Apr 24, 2007 2:21 pm
Jcart | Please use
Jcart | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello Everyone,
I am creating a form and there are several fields in this form. The validation is on the server and NOT on the html page.
The form needs to have special validation that looks at the company name and if the company name is AMCO or BIGBIZ , then the Purchase Number field is required. If the company is a company other than the ones specified, then the Purchase Number isn't required.
My knowledge in PHP is very elementary so any help that can be offered would be greatly appreciated.
Heres the code I have so far:Code: Select all
<?php
$to = "dustiehollon@yahoo.com";
$Purchase_Order = $_POST['Purchase_Order'];
$Ordered_By = $_POST['Ordered_By'];
$Month = $_POST['Month'];
$Day = $_POST['Day'];
$Year = $_POST['Year'];
$Phone_Number = $_POST['Phone_Number'];
$Email_Address = $_POST['Email_Address'];
$d = date('l dS \of F Y ');
$sub = "Order Form Submittal from Website";
$headers = "From: $Ordered_By <$Email_Address>\n";
$headers .= "Content-Type: text/plain; charset=iso-8859-1\n";
$mes .= 'Date & Time: '.$d. "\n";
$mes .= "\n";
$mes .= "Purchase Order: ".$Purchase_Order."\n";
$mes .= "Ordered By: ".$Ordered_By."\n";
$mes .= "Date of Installation: ".$Month." ".$Day.", ".$Year."\n";
$mes .= "\n";
$mes .= "ADDRESS AND CONTACT INFORMATION \n";
$mes .= "\n";
$mes .= "Phone Number: ".$Phone_Number."\n";
$mes .= "E-mail Address: ".$Email_Address." \n";
$companys = Array("AIMCO", "AMCO", "BigBiz");
if ($Ordered_By == $companys) && (empty($Purchase_Order));
{
echo " <div align='center'><h1>Please click the back button on your broswer enter a Purchase Order Number.</h1></div>";
}
else
{
mail($to, $sub, $mes, $headers);
print " <h1><center>Thank you for contacting us!<br>We will be in touch with you very soon.</center></h1>";
}
?>Jcart | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]