Your Staffing Needs
Tell us about your company and you staffing needs. (*Required fields)
if($_POST && $_POST["contact_on"]=="1"){ $company=$_POST["company"]; $name=$_POST["name"]; $title=$_POST["title"]; $phone=$_POST["phone"]; $email=$_POST["email"]; $comments=$_POST["comments"]; $toEmail='staffing@metrics3.com'; $fromEmail=$_POST["email"]; $subjectEmail="Metrics3 Staffing Needs Contact Received"; $strMsg="The following contact information has been received:\n\n"; $strMsg.="Company: ".$company."\n"; $strMsg.="Name: ".$name."\n"; $strMsg.="Title: ".$title."\n"; $strMsg.="Phone: ".$phone."\n"; $strMsg.="Email: ".$email."\n\n"; $strMsg.="Staffing needs: ".$comments."\n"; sendMail($fromEmail,$toEmail,$subjectEmail,$strMsg); #insertDB($fromEmail,$name,$title,$company,$phone,$comments); header('Location:/staffingneeds/thank-you/'); } function insertDB($email,$name,$title,$company,$phone,$comments) { require_once('connection.php'); $ip = gethostbyname($_SERVER['REMOTE_ADDR']); //save the data on the DB mysql_select_db($database_connection, $connection); $insert_query = sprintf("INSERT INTO `metrics3web`.`staffing_needs` (`contact_name`,`title`,`company`,`phone`,`email`,`staffing_need`,`created_from`) VALUES (%s, %s, %s, %s, %s, %s, %s)", sanitize($name, "text"), sanitize($title, "text"), sanitize($company, "text"), sanitize($phone, "text"), sanitize($email, "text"), sanitize($comments, "text"), sanitize($ip, "text")); $result = mysql_query($insert_query, $connection) or die(mysql_error()); } function sendMail($from,$to,$subject,$body){ $header = "From: ". $from . " [" . $from . "]\r\n"; //optional headerfields ini_set('sendmail_from', $from); mail($to, $subject, $body, $header); } function sanitize($value, $type) { $value = (!get_magic_quotes_gpc()) ? addslashes($value) : $value; switch ($type) { case "text": $value = ($value != "") ? "'" . $value . "'" : "NULL"; break; case "long": case "int": $value = ($value != "") ? intval($value) : "NULL"; break; case "double": $value = ($value != "") ? "'" . doubleval($value) . "'" : "NULL"; break; case "date": $value = ($value != "") ? "'" . $value . "'" : "NULL"; break; } return $value; } ?>