Parse errors on php page...
I am new to php and am trying to create a php form on a website I am building for a friend. The form looks like I want it to on the page.
http://www.mosaleen.com/order.html
It also works... sending the info to my email upon submit and redirecting me to the "Thank you for your order page".
The code to make the form function actually rests on the thank you page... I am attaching the code below.
http://www.mosaleen.com/Order.php
Problem is that when I validate the php page it tells me that there are parsing errors. Specifically:
Unable to determine parse mode
Line 1, Column 1:character "Y" not allowed in prolog
AND
Line 1, Column 85:end of document in prolog
Does anyone know where the problem is? I have checked my css sheets and they are validating just fine, so there shouldn't be any issue there. The php script was adapted from the one at http://dreamweaverspot.com/adobe-dreamweaver-tutorial-contact-forms/ if that helps.
<?php
$my_email = "artsyandi@gmail.com";
/*
$continue = "thankyou.html";
*/
$errors = array();
// Remove $_COOKIE elements from $_REQUEST.
if(count($_COOKIE)){foreach(array_keys($_COOKIE) as $value){unset($_REQUEST[$value]);}}
// Check all fields for an email header.
function recursive_array_check_header($element_value)
{
global $set;
if(!is_array($element_value)){if(preg_match("/(%0A|%0D|\n+|\r+)(content-type:|to:|cc:|bcc:)/i",$element_value)){$set = 1;}}
else
{
foreach($element_value as $value){if($set){break;} recursive_array_check_header($value);}
}
}
recursive_array_check_header($_REQUEST);
if($set){$errors[] = "You cannot send an email header";}
unset($set);
// Validate email field.
if(isset($_REQUEST['email']) && !empty($_REQUEST['email']))
{
if(preg_match("/(%0A|%0D|\n+|\r+|:)/i",$_REQUEST['email'])){$errors[] = "Email address may not contain a new line or a colon";}
$_REQUEST['email'] = trim($_REQUEST['email']);
if(substr_count($_REQUEST['email'],"@") != 1 || stristr($_REQUEST['email']," ")){$errors[] = "Email address is invalid";}else{$exploded_email = explode("@",$_REQUEST['email']);if(empty($exploded_email[0]) || strlen($exploded_email[0]) > 64 || empty($exploded_email[1])){$errors[] = "Email address is invalid";}else{if(substr_count($exploded_email[1],".") == 0){$errors[] = "Email address is invalid";}else{$exploded_domain = explode(".",$exploded_email[1]);if(in_array("",$exploded_domain)){$errors[] = "Email address is invalid";}else{foreach($exploded_domain as $value){if(strlen($value) > 63 || !preg_match('/^[a-z0-9-]+$/i',$value)){$errors[] = "Email address is invalid"; break;}}}}}}
}
// Check referrer is from same site.
if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))){$errors[] = "You must enable referrer logging to use the form";}
// Check for a blank form.
function recursive_array_check_blank($element_value)
{
global $set;
if(!is_array($element_value)){if(!empty($element_value)){$set = 1;}}
else
{
foreach($element_value as $value){if($set){break;} recursive_array_check_blank($value);}
}
}
recursive_array_check_blank($_REQUEST);
if(!$set){$errors[] = "You cannot send a blank form";}
unset($set);
// Display any errors and exit if errors exist.
if(count($errors)){foreach($errors as $value){print "$value<br>";} exit;}
if(!defined("PHP_EOL")){define("PHP_EOL", strtoupper(substr(PHP_OS,0,3) == "WIN") ? "\r\n" : "\n");}
// Build message.
function build_message($request_input){if(!isset($message_output)){$message_output ="";}if(!is_array($request_input)){$message_output = $request_input;}else{foreach($request_input as $key => $value){if(!empty($value)){if(!is_numeric($key)){$message_output .= str_replace("_"," ",ucfirst($key)).": ".build_message($value).PHP_EOL.PHP_EOL;}else{$message_output .= build_message($value).", ";}}}}return rtrim($message_output,", ");}
$message = build_message($_REQUEST);
$message = $message . PHP_EOL.PHP_EOL."-- ".PHP_EOL."";
$message = stripslashes($message);
$subject = "Order from MoSaleen.com";
$headers = "From: " . $_REQUEST['email'];
mail($my_email,$subject,$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"><!-- InstanceBegin template="/Templates/subpage.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<style type="text/css" media="all">
<!--
@1552174 url("styles.css");
-->
</style>
<!--[if IE 5]>
<style type="text/css">
#outerWrapper #subcontentWrapper #rightColumn {
width: 220px;
}
</style>
<![endif]-->
<!--[if IE]>
<style type="text/css">
#outerWrapper #subcontentWrapper #content {
zoom: 1;
}
</style>
<![endif]-->
</head>
<body>
<div id="wrapperbackground">
<div id="outerWrapper">
<div id="header">
<div id="logo"><img src="images/logo2.png" alt="g" width="300" height="86" /></div>
<div id="links"><a href="about.html">About Us</a> | <a href="contact.html">Contact Us</a> | 417.825.1498</div>
<div class="clearFloat"></div>
</div>
<div id="nav">
<ul>
<li><a href="index.html"><span>Home</span></a></li>
<li><a href="about.html"><span>Idler Pulley Systems</span></a></li>
<li><a href="testimonials.html"><span>Proven Results</span></a></li>
<li><a href="install.html"><span>Installation</span></a></li>
<li><a href="order.html"><span>Order a System</span></a></li>
<li><a href="contact.html"><span>Contact Us</span></a></li>
</ul>
</div>
<div id="feature" style="display:none;"></div>
<div id="subcontentWrapper">
<div id="content"> <!-- InstanceBeginEditable name="content" -->
<h1>Thank You!</h1>
<p><span style="font-weight: bold">Your order has been submitted.</span> <br />
<br />
Please make your PayPal payment to <a href="mailto:svanhoose57@hotmail.com">svanhoose57@hotmail.com</a> for the required amount (see list below for a reminder on pricing). Once we receive your form AND payment we will confirm your order by email and include all shipping information. <span style="font-weight: bold">If additional information is required we will contact you by phone or email.</span></p>
<p>If you have questions regarding your order or payment, feel free to contact us at 417.825.1498.</p>
<p><img src="images/line.jpg" alt="" width="590" height="10" class="clearFloat" /></p>
<h1>Pricing List</h1>
<p style="font-weight: bold"> Shipping is free on all orders!</p>
<p>99-04 Saleen MoSaleen™ Idler Pulley System<br />
Powder Coated with standard black pulley ($175.00)<br />
Powder Coated with upgraded CNC aluminum anodized pulley ($225.00)<br />
Ceramic Coated with standard black pulley ($190.00)<br />
Ceramic Coated with upgraded CNC aluminum anodized pulley ($240.00)<br />
<br />
05-09 Saleen MoSaleen™ Idler Pulley System ($275.00)</p>
<!-- InstanceEndEditable --></div>
<div id="rightColumn">
<div id="rightColumnContent">
<h3>Saleen Performance Sites</h3>
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li><a href="http://www.teamjdm.com"><img src="images/jdm.png" alt="JDM Engineering" width="200" height="94" /></a></li>
<li><a href="http://www.performanceautosport.com"><img src="images/pauto.png" alt="Performance Autosports" width="200" height="90" /></a> </li>
<li><a href="http://www.brenspeed.com"><img src="images/bren.png" alt="Brenspeed Custom Tuning" width="200" height="82" /></a></li>
<li><a href="http://www.stage3motorsports.com"><img src="images/stage.png" alt="Stage 3 Motorsports" width="200" height="73" /></a></li>
<li><a href="http://www.chicanesport.com"><img src="images/chic.png" alt="Chicane Sport Tuning" width="200" height="81" /></a></li>
<li><a href="http://www.spencerperformance.com"><img src="images/spen.png" alt="Spencer Performance" width="200" height="94" /></a></li>
</ul>
</div>
</div>
<br class="clearFloat" />
</div>
</div>
</div>
<div id="footer"><img src="http://www.justdreamweaver.com/templates/link/spacer.gif" alt="" width="1" height="1" />Copyright © 2008 MoSaleen Performance, LLC <br />
<a href="#">Site Map</a> | <a href="#">Privacy Policy</a> |
Valid <a href="http://validator.w3.org/check?uri=referer">XHTML</a> | <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a></div>
</body>
<!-- InstanceEnd --></html>