% $db = new DB_Leads; include $_SERVER["DOCUMENT_ROOT"]."/leads/common.php"; if(isset($sendit)){ $r = explode(",",$_POST["required"]); $gooddata = 1; foreach($r as $k){ if(empty($_POST[$k])){ $gooddata = 0; $bad[$y++] = $k; print $k; print "here"; } } if($gooddata == 1){ ## Everything checks out, add the entry $leadid = uniqid(""); $timestamp = time(); $query = "insert into leads set timestamp='$timestamp', leadid='$leadid', email='$email', name='$firstname', lastname='$lastname', address='$address', city='$city', state='$state', zip='$zip'"; # remove trailing comma $db->query($query); if ($db->affected_rows() !== 0) { $message = "The following Information Request was submitted through the Famous Merch web site on "; $message .= date("M d, Y"); $message .= " at "; $message .= date("h:i a"); $message .= " Name: ".stripslashes($_POST["firstname"])." Address: ".$_POST["address"]." City: ".$_POST["city"]." State: ".$_POST["state"]." Zip: ".$_POST["zip"]." Comments: ".stripslashes($_POST["comments"])."\n"; require $_SERVER['DOCUMENT_ROOT'].'/includes/n_mail.php'; n_mail("faithandfreedom@aol.com", $_POST["email"], "[Faith And Freedom] Information Request", $message, "Mime-Version: 1.0", $_POST["name"]); header("Location: return.html"); }else{ print "could not be added to the database"; die; } } } %>