Parse error: parse error, expecting `','' or `';''

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
beaner_06
Forum Newbie
Posts: 13
Joined: Tue May 19, 2009 6:11 pm

Parse error: parse error, expecting `','' or `';''

Post by beaner_06 »

I'm getting this error when running my php script: Any help is appreciated.

Parse error: parse error, expecting `','' or `';'' in C:\xampp\htdocs\order-thankyou0.php on line 59

Here is my code:

Code: Select all

<!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>Order Confirmation</title>
<meta name="keywords" content="" />
<meta name="robots" content="NOINDEX" />
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css" media="screen">
.wrapper-main, #merchantHeader { color: #000000; font-family: Arial, Helvetica, sans-serif; }
html { background-color: #ffffff; }
form fieldset legend, .h2, th, .accent, a, a:link, a:visited, a:hover, .header-tabs, .active { color: #336699; }
</style>
</head>
<body>
 
<!-- PAGE ERRORS:
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' on line 46
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' on line 58
-->
 
<?php
$message="";
foreach($_POST as $key=>$value){
$message .= $key . '=' . $value . "<br>\n";
}
echo ($message);
?>
 
<div id="merchantHeader">
<img src="images/logo-pogtrans.gif" alt="PetesOutdoorGrills.com | " style="height: 100px; width: 252px; border-width: 0px;" />
 
</div> 
<!-- begin main template top -->
 
<!-- end main template top -->
<div class="wrapper-main" id="mainWrapper">
<div class="wrapper-header-blank"></div>
 
<!-- BEGIN Page Body -->
<div id="page-body">
 
<!--
<form action="post">
<fieldset>
<legend>Thanks!</legend>
<p>We have successfully received your information.</p>
</fieldset>
</form>
-->
 
<!--
Default Thank You URL: http://www.1shoppingcart.com/app/thankyou.asp?ID=109937
-->
 
<?php
echo"
 
<table id="order-thanks">
<tr>
<td>
<h1>Hi $name thank you for your order.</h1>
<p>Your new order ID is $orderID<br />
You will receive your receipt at $email1</p>
</td>
</tr>
</table>
 
<hr />
 
<table id="order-details">
<tr>
<td>Order ID:</td>
<td>$orderID</td>
</tr>
<tr>
<td>Order Date:</td>
<td>
print date("l");
echo ", " ;
print date("M");
echo "&nbsp;";
print date("j"); 
echo ", " ;
print date("Y");
echo ";</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td style="width: 200px;">
Name:<br />
Company:<br />
Email:
</td>
<td style="width: 250px;">
$name<br />
$company<br />
$email1
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>
Address1:<br />
Address2:<br />
City:<br />
State:<br />
Zip/Postcode:<br />
Country:<br />
Home Phone:<br />
Work Phone: 
</td>
<td>
$address1<br />
$address2<br />
$city<br />
$state<br />
$zip<br />
$country<br />
$homephone<br />
$workphone
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td><b>Ship to:</b></td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="valign-top">
Name:<br />
Address1:<br />
Address2:<br />
City:<br />
State:<br />
Zip/Postcode:<br />
Country:
</td>
<td>
$shipname<br />
$shipAddress1<br />
$shipAddress2<br />
$shipCity<br />
$shipState<br />
$shipZip<br />
$shipCountry
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="valign-top"> 
$product1 X $quantity1<br /><br />
Total<br />
$shippingMethod<br />
State Tax<br />
GST<br />
Grand Total 
</td>
<td> 
= $price1<br />
-----------------<br />
= $Total <br />
= $shippingAmount<br />
= $tax<br />
= $gst<br />
= <b>$grandTotal</b>
</td>
</tr>
</table>
 
";
?>
 
<div class="actions">
<a href="http://www.petesoutdoorgrills.com"><img src="images/button_continue.gif" alt="Continue" style="border-width: 0px;" /></a>
</div>
 
</div>
<!-- END Page Body -->
 
<div class="wrapper-footer">
<div class="left">&copy; <span>2009</span> <a href="</a> - All rights reserved.</div>
 
<div class="right">
 
Powered by <a href="http://www.1shoppingcart.com">1ShoppingCart</a>
 
</div>
</div>
<!--p align="center">1SC-WEB03</p-->
 
</div>
 
 
<SCRIPT LANGUAGE = 'JavaScript'>
<!--
svaid = 204617;
bts_amount = grandTotal;
origin = escape(document.referrer);
-->
</SCRIPT>
<SCRIPT LANGUAGE = 'JavaScript'
SRC="https://www2.higherengine.com/bts/204617/bts.js">
</SCRIPT>
<NOSCRIPT>
<img src="https://www2.higherengine.com/bts/204617/bts.php?svaid=204617&amt=grandTotal" alt="">
</NOSCRIPT>
 
 
</body>
</html>
 
Last edited by Benjamin on Tue May 19, 2009 8:26 pm, edited 1 time in total.
Reason: Changed code type from text to php.
andycain
Forum Newbie
Posts: 19
Joined: Thu Jul 31, 2008 5:21 pm

Re: Parse error: parse error, expecting `','' or `';''

Post by andycain »

On line 57...

Code: Select all

echo"
You have opened the echo statement using double quotes. This means that you will then be closing the echo statement every time the script encounters double quotes within the section you want to echo.

You need to change all the double quotes inside the echo statement to single quotes. Put more simply....

Change all double quotes between lines 58 and 81 to single quote marks.

That will fix your problem.

Example:

Code: Select all

echo "
 
<a href="test.html"> TEST LINK </a>
 
";
This code is wrong because the echo would end after href=

The code below would work....

Code: Select all

 
echo "
 
<a href='test.html'> TEST LINK </a>
 
";
 
Notice the use of single quotes within the echo.

Hope this helps.
Last edited by Benjamin on Tue May 19, 2009 8:26 pm, edited 1 time in total.
Reason: Changed code type from text to php.
Post Reply