mailform help needed!

Discussion in 'PHP' started by bex, Apr 20, 2007.

  1. #1
    Hi i'm new to coding and web design but i'm trying to create a application form. Every time I try and use the form i get this: Method Not Allowed
    The requested method POST is not allowed for the URL /loans/apply.html.

    Here is my html:

    
    <form method="post" action="sendmail.php">
          <p class="style2"><u>Loan Details</u> </p>
          <span class="style1">Loan Type</span>: 
          <label>
          <select name="_loantype" id="_loantype">
            <option>Secured Loan</option>
            <option>Bridging Loan</option>
            <option>Commercial Mortgage</option>
          </select>
          </label>
          <p class="style1">Please enter the Loan amount required:      
            &pound;
            <input name="_loanamount" type="text" id="_loanamount">
          </p>
          <label></label>
          <span class="style1">Term Required: 
          <label>
          <select name="term" id="term">
            <option>5</option>
            <option>6</option>
            <option>7</option>
            <option>8</option>
            <option>9</option>
            <option>10</option>
            <option>15</option>
            <option>20</option>
            <option>25</option>
            <option>30</option>
          </select>
          </label>
          </span>
          <p class="style1">        
          Loan Purpose: 
            <label>
            <select name="purpose" id="purpose">
              <option>Business</option>
              <option>Consolidation</option>
              <option>Furniture</option>
              <option>Holiday</option>
              <option>Mortgage</option>
              <option>Home Improvements</option>
              <option>Property Purchase</option>
              <option>Remortgage</option>
              <option>Vehicle Purchase</option>
              <option>Wedding</option>
              <option>Other</option>
            </select>
            </label>
          </p>
          <p class="style1"><u><strong> Applicants Details - First Applicant</strong></u></p>
          <p class="style1">First Applicants Full Name<strong></strong>: 
            <label>
            <select name="_title" id="_title">
              <option>Mr</option>
              <option>Mrs</option>
              <option>Miss</option>
              <option>Dr</option>
            </select>
            </label>
            <label>
            <input name="_name1" type="text" id="_name1">
            </label>
          </p>
          <p class="style1">Date of Birth: 
            <label>
            <input name="_dob" type="text" id="_dob">
            </label> 
          </p>
          <p class="style1">Full Address (Including Post Code): 
            <label>
            <textarea name="_address" id="_address"></textarea>
            <br>
            <br>
            Telephone No.: 
            <input name="_tel" type="text" id="_tel">
    Mobile:        
    <input name="mobile" type="text" id="mobile">
            <br>
            <br>
            Email: 
            <input name="_email" type="text" id="_email">
            <br>
            </label>
          </p>
          <p class="style1"><u><strong>Applicants Details - Second Applicant (if applicable) </strong></u></p>
          <p class="style1">First Applicants Full Name<strong></strong>:
            <label>
            <select name="_title2" id="_title2">
              <option>Mr</option>
              <option>Mrs</option>
              <option>Miss</option>
              <option>Dr</option>
            </select>
            </label>
            <label>
            <input name="_name2" type="text" id="_name2">
            </label>
    </p>
          <p class="style1">Date of Birth:
            <label>
              <input name="_dob2" type="text" id="_dob2">
              </label>
          </p>
          <p class="style1">Full Address (Including Post Code):
            <label>
              <textarea name="_address2" id="_address2"></textarea>
              <br>
              <br>
              Telephone No.:
      <input name="tel2" type="text" id="tel2">
              Mobile:
      <input name="mobile2" type="text" id="mobile2">
      <br>
      <br>
              Email:
      <input name="email2" type="text" id="email2">
              </label>
          </p>
          <p class="style2"><u>Property Details</u> </p>
          <p class="style1">Property Value &pound;:
            <label>
            <input name="_pvalue" type="text" id="_pvalue">
            </label>
    </p>
          <p class="style1">Mortgage Balance &pound;:
            <label>
            <input name="_mbal" type="text" id="_mbal">
            </label>
    </p>
          <p class="style1">
            <label>
            <input name="_checkbox" type="checkbox" id="_checkbox" value="checkbox">
            </label>
          I/We confirm that I accept the <a href="/tc.html">terms and conditions</a></p>
          <p align="center" class="style1">
            <label>
            <input type="submit" name="Submit" value="Submit">
            </label>
          </p>
          <p class="style1">&nbsp;</p>
          <p class="style1">	
            <label></label>
          </p>
        </form>
    
    Code (markup):

    and here is my php:

    
    <?
      $email = $_REQUEST['_email'] ;
      $_loantype = $_REQUEST['_loantype'] ;
      $_loanamount = $_REQUEST['_loanamount'] ;
      $term = $_REQUEST['term'] ;
      $purpose = $_REQUEST['purpose'] ;
      $_title = $_REQUEST['_title'] ;
      $_name = $_REQUEST['_name'] ;
      $_dob = $_REQUEST['_dob'] ;
      $_address = $_REQUEST['_address'] ;
      $_tel = $_REQUEST['_tel'] ;
      $mobile = $_REQUEST['mobile'] ;
      $_email = $_REQUEST['_email'] ;
      $_title2 = $_REQUEST['_title2'] ;
      $_name2 = $_REQUEST['_name2'] ;
      $_dob2 = $_REQUEST['_dob2'] ;
      $_address2 = $_REQUEST['_address2'] ;
      $_tel2 = $_REQUEST['_tel2'] ;
      $mobile2 = $_REQUEST['mobile2'] ;
      $_email2 = $_REQUEST['_email2'] ;
      $_pvalue = $_REQUEST['_pvalue'] ;
      $_checkbox = $_REQUEST['_checkbox'] ;
      $mbal = $_REQUEST['mbal'] ;
    
      mail( "bex4321@hotmail.com", "New Application from AinsworthFinance.co.uk!",
       Loantype $_loantype 
       Loan amount $_loanamount
       Term $term
       Loan Purpose $purpose
       Applicant 1
       Title $_title
       Name $_name
       dob $_dob
       address $_address
       telephone $_tel
       mobile $mobile
       email $_email
       Applicant 2
       Title $_title2
       Name $_name2
       dob $_dob2
       address $_address2
       telephone $_tel2
       mobile $mobile2
       email $_email2
       Property Details
       Property Value $_pvalue
       Mortgage Balance $mbal
       TC Accepted $_checkbox, "From: $email" );
      header( "Location: http://www.ainsworthfinance.co.uk" );
    ?>
    
    Code (markup):

    I hope someone can help. Thanks in advance guys :)
     
    bex, Apr 20, 2007 IP
  2. commandos

    commandos Notable Member

    Messages:
    3,648
    Likes Received:
    329
    Best Answers:
    0
    Trophy Points:
    280
    #2
    try to change all

    $_xxxxx = $_REQUEST['_xxxxx'] ; to

    $_XXXX = $_POST['_XXXXX'] ;
     
    commandos, Apr 20, 2007 IP
  3. bex

    bex Active Member

    Messages:
    291
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    78
    #3
    ok ill give it a go and come back with what happens! thanks! greens for u!
     
    bex, Apr 20, 2007 IP
  4. bex

    bex Active Member

    Messages:
    291
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    78
    #4
    I still get the error:

    Method Not Allowed
    The requested method POST is not allowed for the URL /loans/apply.html.
     
    bex, Apr 20, 2007 IP
  5. commandos

    commandos Notable Member

    Messages:
    3,648
    Likes Received:
    329
    Best Answers:
    0
    Trophy Points:
    280
    #5
    commandos, Apr 20, 2007 IP
  6. login

    login Notable Member

    Messages:
    8,849
    Likes Received:
    349
    Best Answers:
    0
    Trophy Points:
    280
    #6
    What makes these scripts safe or not ?
     
    login, Apr 20, 2007 IP
  7. bex

    bex Active Member

    Messages:
    291
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    78
    #7
    Thanks for the help commandos, i seemed to have stoped that 405 error and now got another one...

    Parse error: syntax error, unexpected T_VARIABLE in /home/freedom/public_html/loans/sendmail.php on line 26

    
    <?
      $email = $_POST['_email'] ;
      $loantype = $_POST['loantype'] ;
      $loanamount = $_POST['loanamount'] ;
      $term = $_POST['term'] ;
      $purpose = $_POST['purpose'] ;
      $title = $_POST['title'] ;
      $name = $_POST['name'] ;
      $dob = $_POST['dob'] ;
      $address = $_POST['address'] ;
      $tel = $_POST['tel'] ;
      $mobile = $_POST['mobile'] ;
      $email = $_POST['email'] ;
      $title2 = $_POST['title2'] ;
      $name2 = $_POST['name2'] ;
      $dob2 = $_POST['dob2'] ;
      $address2 = $_POST['address2'] ;
      $tel2 = $_POST['tel2'] ;
      $mobile2 = $_POST['mobile2'] ;
      $email2 = $_POST['email2'] ;
      $pvalue = $_POST['pvalue'] ;
      $checkbox = $_POST['checkbox'] ;
      $mbal = $_POST['mbal'] ;
    
      mail( "bex4321@hotmail.com", "New Application from AinsworthFinance.co.uk!",
       Loantype $loantype 
       Loan amount $loanamount
       Term $term
       Loan Purpose $purpose
       Applicant 1
       Title $title
       Name $name
       dob $dob
       address $address
       telephone $tel
       mobile $mobile
       email $email
       Applicant 2
       Title $title2
       Name $name2
       dob $dob2
       address $address2
       telephone $tel2
       mobile $mobile2
       email $email2
       Property Details
       Property Value $pvalue
       Mortgage Balance $mbal
       TC Accepted $_checkbox, "From: $email" );
      header( "Location: http://www.ainsworthfinance.co.uk" );
    ?>
    
    Code (markup):
     
    bex, Apr 20, 2007 IP
  8. commandos

    commandos Notable Member

    Messages:
    3,648
    Likes Received:
    329
    Best Answers:
    0
    Trophy Points:
    280
    #8
    commandos, Apr 20, 2007 IP
  9. commandos

    commandos Notable Member

    Messages:
    3,648
    Likes Received:
    329
    Best Answers:
    0
    Trophy Points:
    280
    #9
    I'm not sure if u can do this :

    <?
       mail( "bex4321@hotmail.com", "New Application from AinsworthFinance.co.uk!",
       Loantype $loantype 
       Loan amount $loanamount
       Term $term
       Loan Purpose $purpose
       Applicant 1
       Title $title
       Name $name
       dob $dob
       address $address
       telephone $tel
       mobile $mobile
       email $email
       Applicant 2
       Title $title2
       Name $name2
       dob $dob2
       address $address2
       telephone $tel2
       mobile $mobile2
       email $email2
       Property Details
       Property Value $pvalue
       Mortgage Balance $mbal
       TC Accepted $_checkbox, "From: $email" );
      header( "Location: http://www.ainsworthfinance.co.uk" );
    ?>
    PHP:
    instead do something like :

    
    
    $message="Loantype $loantype  <br />
                    Loan amount $loanamount <br />
                    Term $term <br />
                    Loan Purpose $purpose <br />
                    Applicant 1 <br />
                    Title $title <br />
                    // ETC .....
    ";
    
    // THEN 
    
    
     mail( "bex4321@hotmail.com", "New Application from AinsworthFinance.co.uk!",$message, "From: $email" );
    header( "Location: http://www.ainsworthfinance.co.uk" );
    
    
    PHP:
     
    commandos, Apr 20, 2007 IP
  10. bex

    bex Active Member

    Messages:
    291
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    78
    #10
    ok thanks m8 i will try this..
     
    bex, Apr 20, 2007 IP
  11. bex

    bex Active Member

    Messages:
    291
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    78
    #11
    
    <?
      $email = $_POST['_email'] ;
      $message = "loantype $loantype <br />
      loanamount $loanamount <br />
      term $term <br />
      purpose $purpose <br/ >
      title $title <br />
      name $name <br />
      dob $dob <br />
      address £address <br />
      tel $tel <br />
      mobile $mobile <br />
      email $email <br />
      title2 $title2 <br />
      name2 $name2 <br />
      dob2 $dob2 <br />
      address2 £address2 <br />
      tel2 $tel2 <br />
      mobile2 $mobile2 <br />
      email2 $email2 <br />
      title2 $title2 <br />
      pvalue $pvalue <br />
      mbal $mbal <br />
      "
      
      
    
      mail( "bex4321@hotmail.com", "New Application from AinsworthFinance.co.uk!",
       $message, "From: $email" );
      header( "Location: http://www.ainsworthfinance.co.uk" );
    ?>
    
    PHP:
    this error...

    Parse error: syntax error, unexpected T_STRING in /home/freedom/public_html/loans/sendmail.php on line 28
     
    bex, Apr 20, 2007 IP
  12. commandos

    commandos Notable Member

    Messages:
    3,648
    Likes Received:
    329
    Best Answers:
    0
    Trophy Points:
    280
    #12
    put a ; after mbal $mbal <br /> " ;
     
    commandos, Apr 20, 2007 IP
  13. bex

    bex Active Member

    Messages:
    291
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    78
    #13
    ok this now works thanks for your help!
     
    bex, Apr 20, 2007 IP