zero-perfoliate
zero-perfoliate

Author Topic: Need Validation  (Read 1180 times)

Offline kris540

  • PHP Workers
  • **
  • Posts: 23
  • Karma: +0/-0
    • Share Expense
Re: Need Validation
« Reply #15 on: November 08, 2009, 01:28:37 PM »
replace the code in your process.php file with this code:
Code: [Select]
<?php 

$Name 
$_POST['Name'];
$Email $_POST['Email'];
$Month $_POST['Month'];
$Day $_POST['Day'];
$YYYY $_POST['YYYY'];
$Comment $_POST['Comment'];

if(
$Name == ""){
$sys_msg "Please fill in the Name field";
$void 1;
}
if(
$Email == "" && $void != 1){
$sys_msg "Please fill in the Email field";
$void 1;
}
if(
$Month == "" && $void != 1){
$sys_msg "Please fill in the Month field";
$void 1;
}
if(
$Day == "" && $void != 1){
$sys_msg "Please fill in the Day field";
$void 1;
}
if(
$YYYY == "" && $void != 1){
$sys_msg "Please fill in the YYYY field";
$void 1;
}
if(
$Comment == "" && $void != 1){
$sys_msg "Please fill in the Comment field";
$void 1;
}

if(
$void != 1){
$message "The name is: $Name 
The Email address is: $Email
THE Date of Birth is :$Day/$Month/$YYYY 
The Comment is: $Comment"
;
mail"me@me.com""Contact Us",$message"From: $Email" );
$sys_msg "Mail Sent Successfully";
//Next line redirects user to thankyou.html
header("Location:thankyou.html");
exit;
}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Process</title>
</head>

<body>
<? echo $sys_msg; ?>
</body>
</html>