homepage Welcome to WebmasterWorld Guest from 54.198.130.203
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
PHP Syntax Error
I'm kind of new to PHP and I'm executing a program for my class, but it
KWilson




msg:4507684
 3:17 am on Oct 13, 2012 (gmt 0)

I'm kind of new to PHP and I'm executing a program for my class, but it keeps saying { [syntax error, unexpected $end, expecting '`' on line 79 } which is the last line of the program that contains no code.. help! i've included the entire code below



<html>
<head>
<title> Automobile Repair Cost </title>
<link rel="stylesheet" type="text/css" href="mypage.css"/>
</head>
<body>
<?php

// receive input from lab5a-1.html

$custName = $_POST['custName'];

$hoursLabor = $_POST['hoursLabor'];

$partsCost = $_POST['partsCost'];

$selectGarage = $_POST['selectGarage'];

//compute $laborCost,$partsCostTax, $partsCostTotal,$totalCost
if ($selectGarage == 1)
{
print ("<p> You selected a Dealer to repair your car. </p>");
$laborCost = 35 * $hoursLabor;
$partsCostTax = $partsCost * .05;
$partsCostTotal = $partsCost + $partsCostTax;
$totalCost = $laborCost + $partsCostTotal;
}
else if ($selectGarage == 2)
{
print ("<p> You selected a Local garage to repair your car.</p>");
$laborCost = 30 * $hoursLabor;
$partsCostTax = $partsCost * .085;
$partsCostTotal = $partsCost + $partsCostTax;
` $totalCost = $laborCost + $partsCostTotal;
}
else
{
print("<p> $selectGarage is an invalid garage selection! Cannot process</p>");
$laborCost = 0;
$partsCostTax = 0;
$totalCost = 0;
}
//display $custName,$selectGarage,$hoursLabor, $laborCost,$partsCostTotal,$totalCost

print ("<p>The customerís name is: $custName</p>");
print ("<p>The garage selected is: $selectGarage</p>");
print ("<p>The hours of labor required to fix your car: $hoursLabor</p>");
print ("<p>The cost for labor to repair your car: $laborCost</p>");
print ("<p>The cost for parts and supplies including tax: $partsCostTotal</p>");
print ("<p>The total cost to repair your car is: $totalCost<p>");
?>
<style type="text/css">

body { padding-left: 11em;font-family:cursive, "Segoe Print", Times, serif; color: blue; background-color: 66FF99 }
ul.navbar { list-style-type: none;
padding: 0;
margin: 0;
position: absolute;
top: 2em;
left: 1em;
width: 9em }
h1{
font-family: Helvetica, Geneva, Arial, SunSans-Regular, sans-ser
ul.navbar li {
background: white;
margin: 0.5em 0;
padding: 0.3em;
border-right: 1em solid black }
ul.navbar a { text-decoration: none }
a:link {color: red }
a:visited { color: purple }
address {
margin-top: 1em;
padding-top: 1em;
border-top: thin dotted }
</style>
</body>
</html>

 

JohnNZ




msg:4507686
 3:28 am on Oct 13, 2012 (gmt 0)

` $totalCost = $laborCost + $partsCostTotal;


Is that a spurious character at the beginning of the line?

Austin80ss




msg:4508851
 11:51 am on Oct 17, 2012 (gmt 0)

Unexpected $end is a common error if you didn't close block structure in your code. (like: if(){..;} , for(){..;})

lucy24




msg:4509113
 10:56 pm on Oct 17, 2012 (gmt 0)

Is that a spurious character at the beginning of the line?

... and if yes, does that mean the program is now holding its breath-- possibly forever-- waiting for a matching ` to close it all up?

ericlewis107




msg:4524486
 11:17 am on Dec 3, 2012 (gmt 0)

Although, since you're still learning, I suggest you move straight away from the mysql_* library. It's very old, slow, and insecure. Instead, look at the improved MySQLi version or PDO. It does look more complicated at the beginning, but you won't regret it.

swa66




msg:4524637
 10:34 pm on Dec 3, 2012 (gmt 0)

As far as security goes, this is an open door for XSS (Cross Site Scripting)

Ref: [owasp.org...]

You must encode output ... and/or validate input.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved