What is the problem in the following code?

<?php
if(isset($_POST['submit']))
{
$fname=$_POST['fname'];
$lname=$_POST['lname'];
$age=$_POST['age'];
$address=$_POST['address'];
$salary=$_POST['salary'];
$borrow=$_POST['borrow'];
echo  "form submitted successfully";
}
else
{
echo "form not submitted";
}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Loan Application Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<b>ICICI Credit Bank Loan Application Form</b>
<br/>
<br/>
<form action="../My%20Documents/loan.php" method="post">
First Name<input name="fname" type="text" size="20" maxlength="10">
Last Name<input name="lname" type="text" size="20" maxlength="10">
Age<input name="age" type="text" size="5" maxlength="5">
<br/>
<br/>
Address<textarea name="address" cols="30" rows="5"></textarea>
<br/>
<br/>
What is your current salary?
<select name="salary">
  <option value="0" selected>Under $10,000</option>
  <option value="10000">$10,000-$25,000</option>
  <option value="25000">$25,000-$50,000</option>
  <option value="50000">Over $50,000</option>
</select>
<br/>
<br/>
How much you want to borrow?
<br/>
<br/>
<input name="borrow" type="radio" value="1000">Our $1,000 package at 8.0% interst
<br/>
<input name="borrow" type="radio" value="5000">Our $5,000 package at 11.5% interst
<br/>
<input name="borrow" type="radio" value="10,000">Our $10,000 package at 15.0% interst
<br/>
<br/>
<input name="submit" type="submit" value="Click here to Submit application">
<input name="reset" type="reset" value="Reset application form">
</form>
</body>
</html>

    Moved to own thread and added

     tags.

      The form works has it should, I am not sure why you have placed:
      echo "form submitted successfully";
      }
      else
      {
      echo "form not submitted";
      on the submitting page has the data is sent to another form to be outputted with the results. And as there does not seam to be any validation going on, I do not see what you want to happen from this code.

      I am no expert that is for sure, but if I can help I will.

        Only problem I can see is that the form's action path is most likely incorrect.

          a year later

          your code basically says, if user submits form-

          'echo "form submitted successfully";'
          else {
          echo "form not submitted";}

          but this else statement is redundant. You only need an else statement when youre checking whats entered in fields- but here you are not checking whats being entered at all.
          so Take out:

          else
          {
          echo "form not submitted";
          }

          So that when user clicks submit, it will say:
          'echo "form submitted successfully";'

            I would guess he's a) gotten it figured out by now or b) given up, since this thread os 15 months old. :-)

              6 months later

              the exchange and later additions are still useful and appreciated. :-)

                Write a Reply...