Heres my code: and Here is a link to the form. http://www.bc-multimedia.com/contact.php
<?php
$YourEmail = Trim(stripslashes($_POST['YourEmail']));
$MyEmail = "dbznss@gmail.com";
$Subject = Trim(stripslashes($_POST['Subject']));
$Name = Trim(stripslashes($_POST['Name']));
$Phone = Trim(stripslashes($_POST['Phone']));
$Message = Trim(stripslashes($_POST['Message']));
$validationOK=true;
if (Trim($YourEmail)=="") $validationOK=false;
if (Trim($Name)=="") $validationOK=false;
if (Trim($Message)=="") $validationOK=false;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=invalid.html\">";
exit;
}
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Phone: ";
$Body .= $Phone;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
$success = mail($MyEmail, $Subject, $Body, "From: <$YourEmail>");
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=sent.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=invalid.html\">";
}
?>
The form works perfectly but when validating it with W3 I get these errors.
Validation Output: 4 Errors
1. Error Line 39, Column 60: document type does not allow element "meta" here
<meta http-equiv="refresh" content="0;URL=invalid.html">
✉
The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).
One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).
2. Error Line 39, Column 61: end tag for "meta" omitted, but OMITTAG NO was specified
<meta http-equiv="refresh" content="0;URL=invalid.html">
✉
You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".
3. Info Line 39, Column 5: start tag was here
<meta http-equiv="refresh" content="0;URL=invalid.html">
4. Error Line 39, Column 61: end tag for "html" omitted, but OMITTAG NO was specified
<meta http-equiv="refresh" content="0;URL=invalid.html">
✉
You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".
5. Info Line 2, Column 1: start tag was here
<html xmlns="http://www.w3.org/1999/xhtml">
6. Error Line 39: Premature end of data in tag html line 2
<meta http-equiv="refresh" content="0;URL=invalid.html">
I just can't seem to solve it. I'm fluent in XHTML and CSS, but only have very basic knowledge in PHP and JavaScript.