Hi all,
I am having some trouble with the loan application script. I think it has to do with $LoanAllowance, but I am unsure. The script seemed to be working fine, except that there is no way to have any loan accepted.
Below is my code for loan.html:
Code:
<form method="POST" action="loan.php">
First Name:
<input name="FirstName" type="text"><br />
Second Name:
<input name="LastName" type="text"><br />
Age:
<input name="Age" type="text" size="3">
<br /><br />
Address:
<textarea name="Address" rows="4" cols="35">
</textarea>
<br />
<br />
What is your current salary?
<select>
<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">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 is
charged at a moderately ridiculous interest rate.
<br />
<input name="Loan" type="radio" value="5000">Our $5,000 package is
charged at a completely ridiculous interest rate.
<br />
<input name="Loan" type="radio" value="10000">Our $10,000 package is
charged at a absolutely ludicrous interest rate.
<br /><br />
<input name="reset" type="reset" value="Reset the application form">
<input name="submit" type="submit" value="Submit the application form">
</form>
And for loan.php:
Code:
<?php
$SalaryAllowance = $_POST['Salary']/5;
$AgeAllowance = ($_POST['Age']/10 - ($_POST['Age']%10)/10)-1;
$LoanAllowance = $SalaryAllowance * $AgeAllowance;
echo "Loan wanted: " . "$_POST[Loan]" . "<br />";
echo "Loan we will allow: " . "$LoanAllowance" . "<br />";
if ($_POST['Loan'] <= $LoanAllowance) echo "Yes, " . "$_POST[FirstName]" . " " . "$_POST[LastName]" . ", we
are delighted to accept your application";
if ($_POST['Loan'] > $LoanAllowance) echo "Sorry, " . "$_POST[FirstName]" . " " . "$_POST[LastName]" . ", we
regret to inform you that we will not be taking advantage of your need for cash at this time.";
?>
Also, I was wondering why I only have to put inverted commas in sometimes, eg, "$_POST[Loan]" vs "$_POST['Age']"?
Thanks in advance,
JaneDean