Hi all please help me to set up my email form see below the error i get :
Parse error: syntax error, unexpected '{' in /home/desesk/public_html/yuyo/contact-form-handler.php on line 9
this is the code of that page :
<?php
$errors = '';
$myemail = 'myemail@hotmail.com';//<-----Put Your email address here.
if(empty($POST['fname']) ||
empty($POST['email']))
empty($POST['cname']) ||
empty($POST['sname']) ||
empty($_POST['mname'])
{
$errors .= "\n Error: all fields are required";
}
$fname = $POST['fname'];
$email_address = $POST['email'];
$cname = $POST['cname'];
$sname = $POST['sname'];
$mname = $_POST['mname'];
if (!preg_match(
"/[a-z0-9-]+(.[a-z0-9-]+)@[a-z0-9-]+(.[a-z0-9-]+)(.[a-z]{2,3})$/i",
$email_address))
{
$errors .= "\n Error: Invalid email address";
}
if( empty($errors))
{
$to = $myemail;
$email_subject = "Contact form submission From yuyo.turetrends.com : $name";
$email_body = "You have received a new message From yuyo.turetrends.com. ".
" Here are the details:\n First Name: $fname \n Email: $email_address \n Company Name: $cname \n Subject: $subject \n Message: $message";
$headers = "From: $myemail\n";
$headers .= "Reply-To: $email_address";
mail($to,$email_subject,$email_body,$headers);
//redirect to the 'thank you' page
header('Location: contact-form-thank-you.html');
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Contact form handler</title>
</head>
<body>
<!-- This page is displayed only if there is some error -->
<?php
echo nl2br($errors);
?>
</body>
</html>
this is the code on the index page:
<!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>
<title>Contact yuyo handyman</title>
<meta name="Description" content="For all your handyman needs.">
<meta name="keywords" content="handyman , home helper" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
// <![CDATA[
jQuery(document).ready(function(){
$('#contactform').submit(function(){
var action = $(this).attr('action');
$.post(action, {
name: $('#name').val(),
email: $('#email').val(),
company: $('#company').val(),
subject: $('#subject').val(),
message: $('#message').val()
},
function(data){
$('#contactform #submit').attr('disabled','');
$('.response').remove();
$('#contactform').before('<p class="response">'+data+'</p>');
$('.response').slideDown();
if(data=='Message sent!') $('#contactform').slideUp();
}
);
return false;
});
});
// ]]>
</script>
</head>
<body>
<div class="main">
<div class="blok_header">
<div class="blok_header_resize">
<div class="click"> <a href="http://twitter.com/jhandy" target="new"><img src="images/RSS_1.gif" alt="" width="24" height="23" border="0" /></a> <a href="http://www.facebook.com/handy" target="new"><img src="images/RSS_2.gif" alt="" width="24" height="23" border="0" /></a>
<p> </p>
</div>
</div>
<div class="click"></div>
<div class="header">
<div class=""><a href=""><img src="images/logo.png" width="336" height="72" border="0" alt="" /></a></div>
<div class="menu">
<ul>
<li><a href="">Home</a></li>
</ul>
</div>
<div class="clr"></div>
</div>
<div class="header_text2">
<img src="images/header_text_img_e.png" alt="" width="105" height="97" />
<h2><a name="quote" id="quote"></a>Welcome to my simple site Yuyo the Handyman! </h2>
<div class="clr"></div>
</div>
<div class="clr"></div>
</div>
<div class="clr"></div>
<div class="body_resize">
<div class="body"><img src="images/icon3.png" width="48" height="42" />
<h3>Send us an email, we'd love to hear from you!</h3>
<p> </p>
<p>Contact <strong>yuyo</strong> at <strong> 566-375-5507</strong> or email <a href="mailto:support@yuyo.zale.com">support@yuyo.zale.com</a></p>
<p>We Will come to your home or office to fix whatever you need to be fixed today !
Not job is too big for Us, use the below contact form to get in touch with us.</p>
<p>Give yuyo a call now or fill out the simple form below and we'll see what we can do to fix your home today!</p>
<p> </p>
<div class="clr"></div>
<div class="body_big">
<form action="contact-form-handler.php" method="post" id="contactform">
<ol>
<li>
<label for="name">First Name <span class="red"></span></label>
<input id="name" name="name" class="text" />
</li>
<li>
<label for="email">Your email <span class="red"></span></label>
<input id="email" name="email" class="text" />
</li>
<li>
<label for="company">Company</label>
<input id="company" name="company" class="text" />
</li>
<li>
<label for="subject">Subject</label>
<input id="subject" name="subject" class="text" />
</li>
<li>
<label for="message">Message <span class="red">*</span></label>
<textarea id="message" name="message" rows="6" cols="50"></textarea>
</li>
<li class="buttons">
<input type="image" name="imageField" id="imageField" src="images/send.jpg" class="send" />
</form>
<script language="JavaScript">
// Code for validating the form
// Visit http://www.javascript-coder.com/html-form/javascript-form-validation.phtml
// for details
var frmvalidator = new Validator("contactform");
frmvalidator.addValidation("name","req","Please provide your name");
frmvalidator.addValidation("email","req","Please provide your email");
frmvalidator.addValidation("email","email","Please enter a valid email address");
</script>
<!--
Sample code from:
http://www.h/contact-form/php-email-contact-form.html
-->
<div class="clr"></div>
</li>
</ol>
</form>
</div>
<div class="block2">
<h2>Contact Details</h2>
<p>Address Info:<br /></p>
<p align="left">Yuyo handyman<br />
11645 sw 36 st dr. <br />
abarenton, VA 456014<br />
<br />
</p>
<p>Other Contacts:<br />
Email: <a href="mailto:support@yuyo.turetrends.com">support@yuyo.turetrends.com</a><br />
Website: www.yuyo.signaturetrends.com/<br />
Phone: 566.879.5507</p>
</div>
<div class="clr"></div>
</div>
<div class="clr"></div>
</div>
</div>
<div class="footer">
<div class="footer_resize">
<p class="leftt">© 2011 All Rights Reserved. yuyo<br/>
<div class="clr"></div>
</div>
<div class="clr"></div>
</div>
</body>
</html>