what is wrong with this code?
// validate the input, beginning with name
$name = trim($_POST['name']);
if (empty($name)) {
$error['name'] = 'Please enter your name';
}
here is the rest of the code
<?php
if (array_key_exists('ewComments', $_POST)) {
// mail processing script
// initialize variables
$to = 'heunesc@gmail.com'; // use your own email address
$subject = 'Feedback from East-West Seasons';
// build the message
$message = 'From: '.$_POST['name']."\n\n";
$message .= 'Email: '.$_POST['email']."\n\n";
$message .= 'Comments: '.$_POST['message'];
// send the email
// remove escape characters from POST array
mail($to, $subject, $message);
}
// remove escape characters from POST array
if (get_magic_quotes_gpc()) {
function stripslashes_deep($value) {
$value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
return $value;
}
$_POST = array_map('stripslashes_deep', $_POST);
}
// validate the input, beginning with name
$name = trim($_POST['name']);
if (empty($name)) {
$error['name'] = 'Please enter your name';
}
?>
<!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=iso-8859-1" />
<title>east west seasons</title>
<?php /*include('style_rules.php');*/ ?>
<script type="text/Javascript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
</head>
<body>
<div id="wrapper">
<div id="titlebar"><img src="" alt="east west season" name="bluebellstop" width="738" height="32" id="bluebellstop" style="background-color: #00CC99" /></div>
<div id="Main content">
<div id="nav">
<ul>
<li id="thispage"><a href="index.php">Home</a></li>
<li><a href="index.php">News</a></li>
<li><a href="index.php">BLog</a></li>
<li><a href="index.php">Gallery</a></li>
<li><a href="index.php">Contact</a></li>
</ul>
</div>
<h1>send us your comments</h1>
<p>Duis aute irure dolor ut labore et dolore magna aliqua. Quis nostrud exercitation sunt in culpa lorem ipsum dolor sit amet. Excepteur sint occaecat ullamco laboris nisi ut labore et dolore magna aliqua. In reprehenderit in voluptate quis nostrud exercitation qui officia deserunt. </p><form action="<?php $_SERVER['PHP_SELF'];?>" method="post" name="Contact form" id="Contact form" onsubmit="MM_validateForm('name','','R','email','','NisEmail','message','','R');MM_validateForm('name','','R','email','','RisEmail','message','','R');return document.MM_returnValue">
<p>
<label for="name">name:</label>
<br />
<input type="text" name="name" id="name" />
</p>
<p>
<label for="email">email</label>
<br />
<input type="text" name="email" id="email" />
</p>
<p>
<label for="message">message<br />
</label>
<textarea name="message" cols="60" rows="6" id="message"></textarea>
</p>
<p>
<input name="ewcomments" type="submit" id="ew comments" value="send comments" />
</p>
</form>
<p> </p>
<div id="footer">
<?php include('copyright.php'); ?>
</div>
</div>
</div>
</body>
</html>