Re: Php script not working
Posted: 19 Sep 2008, 15:32
What type of validation?
Required or Captcha?
Required or Captcha?
An archive of the South African PCFormat forums.
https://tuhinga.ron2k.za.net/pcformat/
Code: Select all
oreach ($_POST as $k=>$v) {
if ($v==''&&$k!='url') {
$err.="The ".$k." field cannot be blank<br/>";
} // end if
}
if (isset($err)&&$err!='') {
echo $err;
} else {
//$httpagent = $_POST['httpagent'];
$httpref = $_POST['$httpref'];
$recipient = "xyz@zy.com";
$fullname = $_POST['fullname'];
$idnumber = $_POST['idnumber'];
$Physicaladdress = $_POST['physicaladdress'];
$Postaladdress = $_POST['postaladdress'];
$Telephonehome = $_POST['telephonehome'];
$Telephonework = $_POST['telephonework'];
$Cell = $_POST['Cell'];
$Join = $_POST['Join'];
$From = "www.website.net";
$comments = $_POST['comments'];
$todayis = date("l, F j, Y, g:i a") ;
$subject = "Bill of Animal Rights";
$message = "Today's date is: $todayis";
$message = "Name: $fullname";
$message .= "ID Number: $idnumber";
$message .= "Physical Address: $Physicaladdress";
$message .= "Postal Address: $Postaladdress";
$message .= "Telephone (home): $Telephonehome";
$message .= "Telephone (work): $Telephonework";
$message .= "Cell Number: $Cell";
$message .= "Join ABVP Law?: $Join";
$message .= "Comments: $comments";
mail($recipient,$subject,$message,$From);
// Page Notification
$notificationPage = "http://www.website.htm";
//redirect here
// Notification
$exit_location = "Location: ".$notificationPage;
header($exit_location);
}
Ok. Thanks. I got validation to work with Javascript but I bear that code in mind for my site.maxxis wrote:Replace the processor page with this code.
Code: Select all
oreach ($_POST as $k=>$v) { if ($v==''&&$k!='url') { $err.="The ".$k." field cannot be blank<br/>"; } // end if } if (isset($err)&&$err!='') { echo $err; } else { //$httpagent = $_POST['httpagent']; $httpref = $_POST['$httpref']; $recipient = "xyz@zy.com"; $fullname = $_POST['fullname']; $idnumber = $_POST['idnumber']; $Physicaladdress = $_POST['physicaladdress']; $Postaladdress = $_POST['postaladdress']; $Telephonehome = $_POST['telephonehome']; $Telephonework = $_POST['telephonework']; $Cell = $_POST['Cell']; $Join = $_POST['Join']; $From = "www.website.net"; $comments = $_POST['comments']; $todayis = date("l, F j, Y, g:i a") ; $subject = "Bill of Animal Rights"; $message = "Today's date is: $todayis"; $message = "Name: $fullname"; $message .= "ID Number: $idnumber"; $message .= "Physical Address: $Physicaladdress"; $message .= "Postal Address: $Postaladdress"; $message .= "Telephone (home): $Telephonehome"; $message .= "Telephone (work): $Telephonework"; $message .= "Cell Number: $Cell"; $message .= "Join ABVP Law?: $Join"; $message .= "Comments: $comments"; mail($recipient,$subject,$message,$From); // Page Notification $notificationPage = "http://www.website.htm"; //redirect here // Notification $exit_location = "Location: ".$notificationPage; header($exit_location); }