p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: parse error when I run your page 101 example ..beginning PHP4


Message #1 by "Art Stoller" <phphelp@w...> on Mon, 30 Sep 2002 16:58:59
I get this error when I run your example on page 101:
I hope you can help is I get it on other scripts as well.
Thanks

Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in 
c:\program files\easyphp\www\loan.php on line 13

The loan.php script is:
<html>
<head></head>
<body>
<b>RBS Bank</b>
<br>
<br>
<?php

$SalaryAllowance = $Salary/5;
$AgeAllowance=($Age/10 - ($Age%10)/10)-1;
$LoanAllowance=$SalaryAllowance * $AgeAllowance;
echo "Loan wanted:$Loan<br>;
echo "Loan amount we will allow you:$LoanAllowance<br><br>";
if ($Loan<=$LoanAllowance) echo "Yes, $FirstName $LastName, we are 
delighted to accpet your application";
if ($Loan>$LoanAllowance) echo "Sorry $Firstname $Lastname. we cannot 
accept yur application at this time";
?>
</body>
</html>


The HTML input form is:
<html>
<head></head>
<body>
<b>RBS Bank loan form</b>
<FORM METHOD=POST ACTION="loan.php">
First name:
<INPUT NAME="FirstName" TYPE="Text">
Last name:
<INPUT NAME="LastName" TYPE="Text">
Age:
<INPUT NAME="Age" type="Text" SIZE="3">
<BR>
<BR>
ADDRESS:
<TEXTAREA NAME="Address" ROWS=4 COLS=40>
</TEXTAREA>
<BR>
<BR>
What is your current salary?
<SELECT NAME="Salary">

<OPTION VALUE=0>Under 10,000</OPTION>
<OPTION VALUE=10000> 10,000 TO 25,000</OPTION>
<OPTION VALUE=25000>25,000 TO 50,000</OPTION>
<OPTION VALUE=50000>50,000 AND  ABOVE</OPTION>
</SELECT>
<BR>
<BR>
HOW MUCH DO YOU WANT TO BORROW?<BR><BR>
<INPUT NAME="Loan" TYPE="Radio" VALUE=1000 >Our 1,000 package at 8% 
interest
<br>
<br>
<INPUT NAME="Loan" TYPE="Radio" VALUE=5000 >Our 5,000 package at 11% 
interest
<br>
<br>
<INPUT NAME="Loan" TYPE="Radio" VALUE=10000 >Our 10,000 package at 15% 
interest
<br>
<br>
<INPUT TYPE=SUBMIT VALUE="Click here to submit application">
<INPUT TYPE=RESET VALUE="Reset application form ">
</FORM>
</BODY>
</HTML>


Message #2 by "KayKay-GG \(E-mail\)" <kaykay@g...> on Mon, 30 Sep 2002 22:00:21 +0530
You're missing the " in the following statement...

echo "Loan wanted:$Loan<br>;

Use an editor that color formats your code...and also uses line numbers..
and you'll prolly avoid errors like these :)

Cheers
-K
>>>>-----Original Message-----
>>>>From: Art Stoller [mailto:phphelp@w...]
>>>>Sent: 30 September 2002 16:59
>>>>To: beginning php
>>>>Subject: [beginning_php] parse error when I run your page
>>>>101 example
>>>>..beginning PHP4
>>>>
>>>>
>>>>I get this error when I run your example on page 101:
>>>>I hope you can help is I get it on other scripts as well.
>>>>Thanks
>>>>
>>>>Parse error: parse error, unexpected T_STRING, expecting
>>>>',' or ';' in
>>>>c:\program files\easyphp\www\loan.php on line 13
>>>>
>>>>The loan.php script is:
>>>><html>
>>>><head></head>
>>>><body>
>>>><b>RBS Bank</b>
>>>><br>
>>>><br>
>>>><?php
>>>>
>>>>$SalaryAllowance = $Salary/5;
>>>>$AgeAllowance=($Age/10 - ($Age%10)/10)-1;
>>>>$LoanAllowance=$SalaryAllowance * $AgeAllowance;
>>>>echo "Loan wanted:$Loan<br>;
>>>>echo "Loan amount we will allow you:$LoanAllowance<br><br>";
>>>>if ($Loan<=$LoanAllowance) echo "Yes, $FirstName $LastName, we are
>>>>delighted to accpet your application";
>>>>if ($Loan>$LoanAllowance) echo "Sorry $Firstname $Lastname.
>>>>we cannot
>>>>accept yur application at this time";
>>>>?>
>>>></body>
>>>></html>
>>>>
>>>>
>>>>The HTML input form is:
>>>><html>
>>>><head></head>
>>>><body>
>>>><b>RBS Bank loan form</b>
>>>><FORM METHOD=POST ACTION="loan.php">
>>>>First name:
>>>><INPUT NAME="FirstName" TYPE="Text">
>>>>Last name:
>>>><INPUT NAME="LastName" TYPE="Text">
>>>>Age:
>>>><INPUT NAME="Age" type="Text" SIZE="3">
>>>><BR>
>>>><BR>
>>>>ADDRESS:
>>>><TEXTAREA NAME="Address" ROWS=4 COLS=40>
>>>></TEXTAREA>
>>>><BR>
>>>><BR>
>>>>What is your current salary?
>>>><SELECT NAME="Salary">
>>>>
>>>><OPTION VALUE=0>Under 10,000</OPTION>
>>>><OPTION VALUE=10000> 10,000 TO 25,000</OPTION>
>>>><OPTION VALUE=25000>25,000 TO 50,000</OPTION>
>>>><OPTION VALUE=50000>50,000 AND  ABOVE</OPTION>
>>>></SELECT>
>>>><BR>
>>>><BR>
>>>>HOW MUCH DO YOU WANT TO BORROW?<BR><BR>
>>>><INPUT NAME="Loan" TYPE="Radio" VALUE=1000 >Our 1,000
>>>>package at 8%
>>>>interest
>>>><br>
>>>><br>
>>>><INPUT NAME="Loan" TYPE="Radio" VALUE=5000 >Our 5,000
>>>>package at 11%
>>>>interest
>>>><br>
>>>><br>
>>>><INPUT NAME="Loan" TYPE="Radio" VALUE=10000 >Our 10,000
>>>>package at 15%
>>>>interest
>>>><br>
>>>><br>
>>>><INPUT TYPE=SUBMIT VALUE="Click here to submit application">
>>>><INPUT TYPE=RESET VALUE="Reset application form ">
>>>></FORM>
>>>></BODY>
>>>></HTML>
>>>>
>>>>
>>>>




  Return to Index