PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 24th, 2011, 11:05 PM
accog accog is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2011
Posts: 1 accog User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 48 m 22 sec
Reputation Power: 0
Syntax parse error!

Hey, gone through this for the past few hours and for the life of me cant find an error. Pretty new to PHP. Any help would be appreciated.

Parse error: syntax error, unexpected T_ECHO in C:\wamp\www\sandbox\PHP195\week4\bugged.php on line 130

Code:
<?php

$programmer_name = "Samuel Ebeling";
$company_name = "Corded";
$styles_path = "styles";
$styles_page = "orders.css";
$heading = "Process Order";
$grand_total = 0;
$item_total = 0;

$page_names = array();

$page_names[0] = array("home.php", "Home", "user");
$page_names[1] = array("processorder.php", "Process Order", "user");

?>

<!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" xml:lang="en" lang="en">

<head>

<title><?php echo $heading; ?></title>

<link rel = "stylesheet" type = "text/css" href = "<?php echo $styles_path . '/' . $styles_page; ?>" /> 

</head>

<body>

<div class = "shade">

<br />
Logged in as: <b>(no login code yet)</b>

<p>

<a href = "<?php echo $page_names[0][0]; ?>"><?php echo $page_names[0][1]; ?></a>&nbsp;
<a href = "<?php echo $page_names[1][0]; ?>"><?php echo $page_names[1][1]; ?></a>

</p>

</div>

<h1><?php echo $heading; ?></h1>
<h2><?php echo $programmer_name; ?></h2>

<?php

$users = array();

$users[0] = array("administrator","pass1234","admin","Student","Name","123 Main St. Portland OR 97213");
$users[1] = array("instructor","pass1234","admin","Ron","Bekey","234 SE Second St., Portland OR 97219");
$users[2] = array("customer","pass1234","user","Joe","Jones","3567 SE Hawthorne St., Portland OR 97214");

$products = array();

$products[0] = array("1", "A/V Switch", "12.99", "image1.jpg");
$products[1] = array("2", "VGA to DVI Adapter", "4.89", "image2.jpg");
$products[2] = array("3", "Car Plug USB Charger", "6.99", "image3.jpg");
$products[3] = array("4", "Bluetooth USB Dongle", "10", "image4.jpg");

$cart_items = array();

$cart_items[0] = array(0,4);
$cart_items[1] = array(1,2);
$cart_items[2] = array(2,6);
$cart_items[3] = array(3,1);

$headings = array("Product Name", "Quantity", "Product Price", "Total");

$row = array();

$counter = 0;

while ($counter < 4){
     $product_id = $cart_items[$counter][0]; 
     $row[$counter][0] = $products[$product_id][1]; // Product Name
     $row[$counter][1] = $cart_items[$counter][1]; // Quantity
     $row[$counter][2] = $products[$product_id][2]; // Product Price
     $row[$counter][3] = $row[$counter][1] * $row[$counter][2]; // Total: Quantity * Price
     $counter++;
}

?>

<p>Date and Time: <b><?php echo date("m/d/y h:i A"); ?></b></p>

<p>Customer: <b><?php echo $users[2][3] . " " . $users[2][4]; ?></b></p>

<p>Ship to: <b><?php echo $users[2][5]; ?></b></p>

<table border="1">

<tr class="shade">

  <?php 
        //Headings row
		
		$counter = 0;
		
		while ($counter < 4){
		     echo "<td width='100'>";
			 echo $headings[$counter];
			 echo "</td>";
			 $counter++;
		}
		
  ?>
  
</tr>

<?php

$row_number = 0;

while($row_number < 4){
     
     echo "<tr>";
	 
	 $counter = 0;
	 
while($counter < 4){

if($counter == 2 || $counter == 3){
    $table_contents = $row[$row_number][$counter] . "&nbsp;</td>";
	echo "<td width='100'>";
	echo "\$" . echo $table_contents;
	$counter++;
}
else{
     $table_contents = $row[$row_number][$counter] . "&nbsp;</td>";
     echo "<td width='100'>";
     echo $table_contents;
     $counter++;

	 
}
	  
     echo "</tr>";

     $grand_total += $row[$row_number][3]; // The right side is the Total from step 12b
     $item_total += $row[$row_number][1]; // The right side is the Quantity from step 12b
     $row_number++;
} 
}
?>

</table>

<?php

echo "<p>Total items: " . $item_total . "</p>";

echo "<p>Total order: \$" . number_format($grand_total, 2) . "</p>";

?>

</body>

</html>

Last edited by accog : October 24th, 2011 at 11:13 PM. Reason: Forgot to give the error

Reply With Quote
  #2  
Old November 4th, 2011, 06:48 AM
mark40 mark40 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2011
Posts: 1 mark40 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 m 49 sec
Reputation Power: 0
Red face Thank you

Thank you

Good post

I like your post.

Thats good....

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Syntax parse error!


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap