Hello all,
I am new to web design and currently creating a website for my graphic design company. I am stuck on a form I have put together. The php file which attaches isn't working properly, it loads as a blank page, whether the info is correct in the completed form or not. Please could anyone review it and let me know where I may have gone wrong
PHP Code:<?php
if(isset($_POST['email'])) {
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "hello@creativeiscaboodle.co.uk";
$email_subject = "Job Sheet from Creative Caboodle Website";
function died($error) {
// your error code can go here
echo "We are very sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error."<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
// validation expected data exists
if(!isset($_POST['Company_Name']) ||
!isset($_POST['Contact_Name']) ||
!isset($_POST['Email_Address'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$Company_Name = $_POST['Company_Name']; // required
$Contact_Name = $_POST['Contact_Name']; // required
$Phone_Number = $_POST['Phone_Number']; // not required
$Email_Address = $_POST['Email_Address']; // required
$Website = $_POST['Website']; // not required
$Address = $_POST['Address']; // not required
$Tell_Us_About_Your_Company = $_POST['Tell_Us_About_Your_Company']; // not required
$Target_Audience = $_POST['Target_Audience']; // not required
$Existing_Identity_And_Guidelines = $_POST['Existing_Identity_And_Guidelines']; // not required
$Design_Needs= $_POST['Design_Needs']; // not required
$Printing_Requirements = $_POST['Printing_Requirements']; // not required
$Supply_Of_Images = $_POST['Supply_Of_Images']; // not required
$Additional_Info = $_POST['Additional_Info']; // not required
$Websites_Like = $_POST['Websites_Like']; // not required
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp,$Email_Address)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}
$string_exp = "/^[A-Za-z .'-]+$/";
if(!preg_match($string_exp,$Company_Name)) {
$error_message .= 'The Company Name you entered does not appear to be valid.<br />';
}
if(!preg_match($string_exp,$Contact_Name)) {
$error_message .= 'The Contact Name you entered does not appear to be valid.<br />';
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Form details below.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "Company Name: ".clean_string($Company_Name)."\n";
$email_message .= "Contact Name: ".clean_string($Contact_Name)."\n";
$email_message .= "Phone Number: ".clean_string($Phone_Number)."\n";
$email_message .= "Email Address: ".clean_string($Email_Address)."\n";
$email_message .= "Website: ".clean_string($Website)."\n";
$email_message .= "Address: ".clean_string($Address)."\n";
$email_message .= "Please tell us about your company, including a brief summary of your products / services: ".clean_string($Tell_Us_About_Your_Company)."\n";
$email_message .= "What’s your target audience: ".clean_string($Target_Audience)."\n";
$email_message .= "Do you have any existing corporate identity / guidelines (please include details of any colours, fonts, logo’s etc): ".clean_string($Existing_Identity_And_Guidelines)."\n";
$email_message .= "What are you looking for i.e. business card, logo design, website design and build, leaflet etc (please be as detailed as possible): ".clean_string($Design_Needs)."\n";
$email_message .= "If your project is for print, please provide details of any specific requirements, such as gloss finish, qty etc: ".clean_string($Printing_Requirements)."\n";
$email_message .= "Will you be supplying any relevant imagery required for the project or do you want us to source this: ".clean_string($Supply_Of_Images)."\n";
$email_message .= "Is there anything else we need to know such as deadlines, budgets, design concepts etc: ".clean_string($Additional_Info)."\n";
$email_message .= "If You would like a website, please provide website address of websites you like the look of and what you like about them: ".clean_string($Websites_Like)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
<!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></title>
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700' rel='stylesheet' type='text/css'>
<link href="css/job_stylesheet.css" rel="stylesheet" type="text/css" />
</head>
<body onload="initialize()">
<div id="headerwrapper">
<div id="header">
<div id="social">
<a href="http://www.facebook.com/creativeiscaboodle"> <img src="images/facebook.png" width="25" height="27" alt="Creative Caboodle Facebook" onmouseover="this.src='images/facebook1.png';" onmouseout="this.src='images/facebook.png';"/></a>
<a href="http://uk.linkedin.com/in/creativecaboodle/"> <img src="images/linkedin.png" width="25" height="27" alt="Creative Caboodle Linkedin" onmouseover="this.src='images/linkedin1.png';" onmouseout="this.src='images/linkedin.png';"/></a></br>
<class="toplinks">
<a href = "http://system.creativeiscaboodle.co.uk">Client Log In</a></span></p>
</class>
</div>
<a href="http://www.creativeiscaboodle.co.uk"> <img src="images/logo.png" alt="Creative Caboodle Logo" /></a>
<div id="menu">
<ul>
<li class="menu1"> <a href="http://www.creativeiscaboodle.co.uk/index.html">Home</a></li>
<li class="menu2"> <a href="http://www.creativeiscaboodle.co.uk/profile.html">Profile</a></li>
<li class="menu3"> <a href="http://www.creativeiscaboodle.co.uk/work.html">Work</a></li>
<li class="menu4"> <a href="http://www.creativeiscaboodle.co.uk/services.html">Services</a></li>
<li class="menu5"> <a href="http://www.creativeiscaboodle.co.uk/unwind.html">Unwind</a></li>
<li class="menu6"> <a href="http://www.creativeiscaboodle.co.uk/connect.html">Connect</a></li>
<li class="menu7"> <a href="http://www.creativeiscaboodle.co.uk/dashboard.html">Dashboard</a></li>
</ul>
</div>
</div>
</div>
<div class="clear"></div>
</div>
<div id="wrapper">
</br>
</br>
</br>
<h1>
<center>Thank you, one of team will be in touch shortly</center>
</h1>
</div>
<div id="footerwrapper">
<div id="footer">
<div class="footertitle">
Creative Caboodle
</div>
<div class="copyright">
<a href="http://www.creativeiscaboodle.co.uk/privacy_policy.html">Privacy Policy</a> | <a href="http://www.creativeiscaboodle.co.uk/terms_and_conditions.html">Terms & Conditions</a> | Copyright © Creative Caboodle 2012-2014 | All rights resevered
</div>
</div>
</div>
</body>
</html>
<?php
}
?>



Reply With Quote

Bookmarks