Wrox Programmer Forums
|
BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5
This is the forum to discuss the Wrox book Beginning PHP4 by Wankyu Choi, Allan Kent, Chris Lea, Ganesh Prasad, Chris Ullman; ISBN: 9780764543647
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 20th, 2006, 05:15 AM
Authorized User
 
Join Date: Nov 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default error in script i downloaded

The script i downloaded, does not display the correct output here's the code

<HTML>
<HEAD></HEAD>
<BODY>
<B>Namllu Credit Bank Loan Application 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 $10000</OPTION>
<OPTION VALUE=10000>$10,000 to $25,000</OPTION>
<OPTION VALUE=25000>$25,000 to $50,000</OPTION>
<OPTION VALUE=50000>Over $50,000</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.0% interest
<BR>
<INPUT NAME="Loan" TYPE="Radio" VALUE=5000>Our $5,000 package at 11.5% interest
<BR>
<INPUT NAME="Loan" TYPE="Radio" VALUE=10000>Our $10,000 package at 15.0% interest
<BR>
<BR>
<INPUT TYPE=SUBMIT VALUE="Click here to Submit application">
<INPUT TYPE=RESET VALUE="Reset application form">
</FORM>
</BODY>
</HTML>

and this one

<HTML>
<HEAD></HEAD>
<BODY>
<B>Namllu Credit Bank Loan Application Form</B>
<BR>
<BR>
<?
$SalaryAllowance = $Salary/5;
$AgeAllowance = ($Age/10 - ($Age%10)/10)-1;
$LoanAllowance = $SalaryAllowance * $AgeAllowance;
echo "Loan wanted:$Loan<BR>";
echo "Loan amount we will allow:$LoanAllowance<BR><BR>";
if ($Loan <= $LoanAllowance) echo "Yes, $FirstName $LastName, we are delighted to accept your application";
if ($Loan > $LoanAllowance) echo "Sorry, $FirstName $LastName, we cannot accept your application at this time";
?>
</BODY>
</HTML>

the browser im using is IE6 and Firefox 2.0, is there something wrong with the code or my browser that has problem... Please help....
 
Old January 3rd, 2007, 12:41 AM
Registered User
 
Join Date: Dec 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi knightneo,

I don't know why the problem is happening (based on what I've seen in the forums, maybe something to do with register globals being on/off), but you can fix it by putting $_POST[name] in instead of just $name.

Try this, it worked for me:
Code:
<?
$SalaryAllowance = $POST_[Salary]/5;
$AgeAllowance = ($_POST['Age']/10 - ($_POST['Age']%10)/10)-1;
$LoanAllowance = $SalaryAllowance * $AgeAllowance;
echo "Loan wanted:$_POST[Loan]<BR>";
echo "Loan amount we will allow:$LoanAllowance<BR><BR>";
if ($Loan <= $LoanAllowance) echo "Yes, $_POST[FirstName] 

$_POST[LastName], we are delighted to accept your application";
if ($Loan > $LoanAllowance) echo "Sorry, $_POST[FirstName] 

$_POST[LastName], we cannot accept your application at this time";
?>





Similar Threads
Thread Thread Starter Forum Replies Last Post
accessibility coding error in downloaded file hillcountry BOOK: Accessible XHTML and CSS Web Sites: Problem Design Solution 0 November 21st, 2006 05:37 PM
error in downloaded code hertendreef BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 April 9th, 2006 04:56 AM
downloaded code show me error from this site josna VS.NET 2002/2003 0 December 18th, 2005 09:15 AM
Error on local load of downloaded app Gjerstad BOOK: ASP.NET Website Programming Problem-Design-Solution 4 June 21st, 2003 10:36 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.