Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 7 of 7
  1. #1
    Member AllenP's Avatar
    Join Date
    Jul 2005
    Location
    Perris,CA
    Posts
    55
    Member #
    10453
    Hi, I'm new to PHP. I need to create a secure online form to email information to my client. So far I have created the form and the form handle script. The problem I am currently having is that the form inforamtion emails, but the HTML formatting does not show, I see the tags instead. I was under the impression that nearly all email clients supported basic HTML tags. Im only using the paragraph tag some text headers and line breaks.

    Eventually I also need to figure out how to have the information sent over a secure server connection. How difficult is this? Do I need to change my code to account for the HTTPS connection? I need any tips that I can get on how to code better in PHP and how to improve this form.

    Thanks



    here is the code for the handle script handle.php

    Code:
    <?php require('required/header.html'); ?>
    <?php require('required/divsandnav.html'); ?>
    
    
    
    <?php 
    
    //adjusting in case register globals is disabled
    
    
    
    
    
    
    
    
    
    //Begining of Primary borrowers contact information section
    
    
    
    
    
    
    
    
    
    
    //Primary Borrowers Full Name
    $pbfullname = $_POST['pbfullname'];
    
    //Primary Borrowers Phone Number
    $pbphonenumber = $_POST['pbphonenumber'];
    
    //Primary Borrowers Date Of Birth
    $pbdob = $_POST['pbdob'];
    
    //Primary Borrowers Social Security Number
    $pbssn = $_POST['pbssn'] ;
    
    //Primary Borrowers Email Adress
    $pbemail = $_POST['pbemail'];
    
    
    
    
    
    
    
    
    
    
    //Begining of Secondary borrowers contact information section 
    
    
    
    
    
    
    
    
    
    
    //Secondary Borrowers Full Name
    $sbfullname = $_POST['sbfullname'];
    
    //Secondary Borrowers Telephone Number
    $sbphonenumber = $_POST['sbphonenumber'];
    
    //Secondary Borrowers Date of Birth
    $sbdob = $_POST['sbdob'];
    
    //Secondary Borrowers Social Security Number
    $sbssn = $_POST['sbssn'];
    
    //Secondary Borrowers Email Adress
    $sbemail = $_POST['sbemail'];
    
    
    
    
    
    
    
    
    
    
    //Begining of Primary Residence Info Section 
    
    
    
    
    
    
    
    
    
    
    //Primary Residence Adress
    $pradress = $_POST['pradress'];
    
    //Primary Residence City
    $prcity = $_POST['prcity'];
    
    //Primary Residence State
    $prstate = $_POST['prstate'];
    
    //Primary Residence Zip/Postal Code
    $przip = $_POST['przip'];
    
    //Do you rent or own
    $rentorown = $_POST['rentorown'];
    
    //Number of years in primary residence
    $pryears = $_POST['pryears'];
    
    //Current Mortgage/ Rental Payment
    $prpayment = $_POST['prpayment'];
    
    //Number of Late Payments In The Last 24 Months
    $prlatepayments  = $_POST['prlatepayments'];
    
    //Additional Comments
    $prcomments = $_POST['prcomments'];
    
    
    
    
    
    
    
    
    
    //Begining of Loan Information Section 
    
    
    
    
    
    
    
    
    
    
    //Purpose Of Loan
    $loanpurpose = $_POST['loanpurpose'];
    
    //Property Type
    $propertytype = $_POST['propertytype'];
    
    //Property Will Be
    $propertywillbe  = $_POST['propertywillbe'];
    
    
    
    
    
    
    
    
    //Begining of  property adress section 
    
    
    
    
    
    
    
    
    
    
    //Property Adress
    $propertyadress = $_POST['propertyadress'];
    
    //Property City
    $propertycity  = $_POST['propertycity'];
    
    //Property State
    $propertystate = $_POST['propertystate'];
    
    //Property Zip Code
    $propertyzip = $_POST['propertyzip'];
    
    
    
    
    
    
    
    
    
    //Begining of Borrowers Information Section 
    
    
    
    
    
    
    
    
    
    
    //Are you self employed?
    $pbselfemployed = $_POST['pbselfemployed'];
    
    //Name of employer
    $pbemployersname = $_POST['pbemployersname'];
    
    //Position/Title/Type of buisness
    $pb_pos_tit_bus = $_POST['pb_pos_tit_bus'];
    
    //Primary Borrowers Employer's Adress
    $pbemployersadress = $_POST['pbemployersadress'];
    
    //Primary Borrowers Employers City
    $pbemployerscity = $_POST['pbemployerscity'];
    
    //Primary Borrowers Employers State
    $pbemployersstate = $_POST['pbemployersstate'];
    
    //Primary Borrowers Employers Zip Code
    $pbemployerzip  = $_POST['pbemployerzip'];
    
    //Primary BorrowersYears on job
    $pbyearsonjob = $_POST['pbyearsonjob'];
    
    //Primary BorrowersYears in profession
    $pbyearsinproffesion = $_POST['pbyearsinproffesion'];
    
    //Primary Borrowers Buisness Phone
    $pbbusinessphone  = $_POST['pbbusinessphone'];
    
    //Monthly Income (Gross Before Taxes)
    $pbmonthlyincome = $_POST['pbmonthlyincome'];
    
    
    
    
    
    
    
    
    
    //Begining of co-borrower information section 
    
    
    
    
    
    
    
    
    
    
    //Are you self employed?
    $cbselfemployed = $_POST['cbselfemployed'];
    
    //Co-borrower employer 's name
    $cbemployername  = $_POST['cbemployername'];
    
    //Co Borrower Position/Title/Type or buisness
    $cb_pos_tit_bus = $_POST['cb_pos_tit_bus'];
    
    //Co Borrowers Employer's Adress
    $cbemployersadress  = $_POST['cbemployersadress'];
    
    //Co Borrowers Employers City
    $cbemployerscity = $_POST['cbemployerscity'];
    
    //Co Borrowers Employee State
    $cbemployersstate = $_POST['cbemployersstate'];
    
    //Co Borrowers Employee Zip Code
    $cbemployerzip = $_POST['cbemployerzip'];
    
    //Co Borrowers Years on job
    $cbyearsonjob = $_POST['cbyearsonjob'];
    
    //Co Borrowers Years in profession
    $cbyearsinprofession = $_POST['cbyearsinprofession'];
    
    //Co Borrowers Buisness Phone
    $cbbuisnessphone = $_POST['cbbuisnessphone'];
    
    //Co Borrowers Monthly Income (Gross Before Taxes)
    $cbmonthlyincome  = $_POST['cbmonthlyincome'];
    
    
    
    
    
    
    
    
    
    
    //Begining of assests section 
    
    
    
    
    
    
    
    
    
    //Financial Institution/Bank
    $bank = $_POST['bank'];
    
    //Account Number
    $accountnumber = $_POST['accountnumber'];
    
    //Average Balance
    $averagebalance = $_POST['averagebalance'];
    
    //First Automobile: Year, Make and Model
    $autooneymm  = $_POST['autooneymm'];
    
    //First Automobile Value
    $autoonevalue = $_POST['autoonevalue'];
    
    //Second Automobile: Year, Make and Model
    $autotwoymm = $_POST['autotwoymm'];
    
    //Second Automobile Value
    $autotwovalue  = $_POST['autotwovalue'];
    
    //Third Automobile: Year, Make and Model
    $autothreeymm  = $_POST['autothreeymm'];
    
    //Third Automobile Value
    $autothreevalue = $_POST['autothreevalue'];
    
    //Financial/Retirement Assets (Estimated Value)
    $financialretirementassets  = $_POST['financialretirementassets'];
    
    //Do you own any additional real estate? If yes.............
    $textboxtwo  = $_POST['textboxtwo'];
    
    //Have you ever had a bankruptcy?
    $bakruptcyyesorno  = $_POST['bakruptcyyesorno'];
    
    //If yes, has it been discharged?
    $bankruptcydischargeyesorno = $_POST['bankruptcydischargeyesorno'];
    
    //Have you had a Foreclosure?
    $foreclosure  = $_POST['foreclosure'];
    
    
    $sec1="<h2>Primary Borrower Contact Information</h2><p><b>Primary Borrowers Full Name:</b><br/> $pbfullname<br/><b>Telephone Number:</b><br/> $pbphonenumber<br /><b>Primary Borrowers Date Of Birth:</b><br/>$sbdob<br/><b>Primary Borrowers Social Security Number:</b><br/>$pbssn<br/><b>Primary Borrowers Email Adress:</b><br/>$pbemail<br/><br /><br /></p>";
    
    $sec2="<h2>Secondary borrowers contact information</h2><p><b>Primary Borrowers Full Name: </b><br/>$sbfullname<br/><b>Telephone Number: </b><br/>$sbphonenumber<br /><b>Primary Borrowers Date Of Birth:</b><br/>$sbdob<br/><b>Primary Borrowers Social Security Number:</b><br/>$sbssn<br/><b>Primary Borrowers Email Adress:</b><br/>$sbemail<br/><br /><br /></p>";
    
    $sec3="<h2>Primary Residence Info</h2><p><b>Primary Residence Adress:</b><br/>$pradress <br/><b>Primary Residence City:</b><br/>$prcity <br/><b>Primary Residence State:</b><br/>$prstate<br/><b>Primary Residence Zip/Postal Code:</b><br/>$przip <br/><b>Rent or Own:</b><br/>$rentorown<br/><b>Number of years in primary residence:</b><br/>$pryears<br/><b>Current Mortgage/ Rental Payment:</b><br/>$prpayment <br/><b>Number of Late Payments In The Last 24 Months:</b><br/>$prlatepayments<br/><b>Additional Comments:</b><br/>$prcomments<br/></p>";
    
    $sec4="<h2>Loan Information Section </h2><p><b>Purpose Of Loan:</b><br/>$loanpurpose<br/><b>Property Type:</b><br/>$propertytype<br/><b>Property Will Be:</b><br/>$propertywillbe<br/></p>";
    
    $sec5="<h2>Property Adress Section </h2><p><b>Property Adress:</b><br/>$propertyadress<br/><b>Property City:</b><br/>$propertycity<br/><b>Property State:</b><br/>$propertystate<br/><b>Property Zip Code:</b><br/>$propertyzip<br/></p>";
    
    $sec6="<h2>Begining of Borrowers Information Section </h2><p><b>Are you self employed?:</b><br/>$pbselfemployed<br/><b>Name of employer:</b><br/>$pbemployersname<br/><b>Position/Title/Type of buisness:</b><br/>$pb_pos_tit_bus<br/><b>Primary Borrowers Employers Adress:</b><br/>$pbemployersadress<br/><b>Primary Borrowers Employers City:</b><br/>$pbemployerscity <br/><b>Primary Borrowers Employers State:</b><br/>$pbemployersstate<br/><b>Primary Borrowers Employers Zip Code:</b><br/>$pbemployerzip<br/><b>Primary BorrowersYears on job:</b><br/>$pbyearsonjob<br/><b>Primary BorrowersYears in profession:</b><br/>$pbyearsinproffesion<br/><b>Primary Borrowers Buisness Phone:</b><br/>$pbbusinessphone<br/><b>Monthly Income (Gross Before Taxes):</b><br/>$pbmonthlyincome<br/></p>";
    
    $sec7="<h2>Co-Borrower Information Section </h2><p><b>Are you self employed?:</b><br/>$cbselfemployed<br/><b>Name of employer:</b><br/>$cbemployername<br/><b>Position/Title/Type of buisness:</b><br/>$cb_pos_tit_bus<br/><b>Co Borrowers Employers Adress:</b><br/>$cbemployersadress<br/><b>Co Borrowers Employers City:</b><br/>$cbemployerscity <br/><b>Co Borrowers Employers State:</b><br/>$cbemployersstate<br/><b>Co Employers Zip Code:</b><br/>$cbemployerzip<br/><b>Co Borrowers Years on job:</b><br/>$cbyearsonjob<br/><b>Co BorrowersYears in profession:</b><br/>$cbyearsinprofession<br/><b>Co Borrowers Buisness Phone:</b><br/>$cbbuisnessphone<br/><b>Monthly Income (Gross Before Taxes):</b><br/>$cbmonthlyincome<br/></p>";
    
    $sec8="<h2>Assests Section </h2><p><b>Financial Institution/Bank:</b><br/>$bank<br/><b>Account Number:</b><br/>$accountnumber<br/><b>Average Balance:</b><br/>$averagebalance<br/><b>First Automobile: Year, Make and Model:</b><br/>$autooneymm<br/><b>First Automobile Value:</b><br/>$autoonevalue<br/><b>Second Automobile: Year, Make and Model:</b><br/>$autotwoymm<br/><b>Second Automobile Value:</b><br/>$autotwovalue<br/><b>Third Automobile: Year, Make and Model:</b><br/>$autothreeymm<br/><b>Third Automobile Value:</b><br/>$autothreevalue<br/><b>Financial/Retirement Assets (Estimated Value):</b><br/>$financialretirementassets<br/><b>Do you own any additional real estate?<br/>If yes, please list the addresses, mortgage holders and<br/>monthly expenses including itemized hazard insurance and taxes. </b><br/>$textboxtwo<br/><b>Have you ever had a bankruptcy?:</b><br/>$bakruptcyyesorno<br/><b>If yes, has it been discharged?:</b><br/>$bankruptcydischargeyesorno<br/><b>Have you had a Foreclosure?:</b><br/>$foreclosure<br/></p>";
    
    $results =  $sec1.$sec2.$sec3.$sec4.$sec5.$sec6.$sec7.$sec8;
    
      mail( "allenpope@gmail.com", "Form Results",
        "<body>$results</body>", "From:noreply@fixyourarm.net" );
    
    print 
    (
    "<h3>Thanks You For Filling out our form,<br/>The Following Information Has Been Submitted</h3> $results"
    );
    
    ?>
    
    
    
    
    
    
    <?php require('required/footer.html'); ?>
    Attached Images Attached Images

  2.  

  3. #2
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    You need to send the proper content-type header to send HTML messages:
    Code:
    Content-type: text/html
    ...and ideally, the charset too:
    Code:
    Content-type: text/html; charset="UTF-8"
    ...IIRC.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  4. #3
    Member AllenP's Avatar
    Join Date
    Jul 2005
    Location
    Perris,CA
    Posts
    55
    Member #
    10453
    Thank you filburt, but I'm confused as to where I would put this within my script.

    I tried this and it ends up the same

    Code:
    mail( "allenpope@gmail.com", "Form Results",
        "<meta Content-type: text/html; charset="UTF-8"/>$results", "From:noreply@fixyourarm.net" );

  5. #4
    Member AllenP's Avatar
    Join Date
    Jul 2005
    Location
    Perris,CA
    Posts
    55
    Member #
    10453
    I figured out how to send the headers and it kept on displaying wrong in my gmail account. I finally got fed up and thought that the problem might lay in gmail. So I set up a temporary account on mytrashmail.com and it displays fine there. Does anyone know a way to get it to work in gmail too?

  6. #5
    ljm
    ljm is offline
    Senior Member ljm's Avatar
    Join Date
    Aug 2006
    Location
    Manchester, England
    Posts
    284
    Member #
    13684
    Liked
    1 times
    You need to set the headers right:

    PHP Code:
    mail"allenpope@gmail.com""Form Results",
        
    "$results""content-type: text/html;\r\n charset=\"UTF-8\";\r\n From:noreply@fixyourarm.net" ); 
    Notice how I've put the content type and charset in the headers, and separated each one with [minicode]\r\n[/minicode].
    To be honest I'm not entirely sure what \r does, but \n tells PHP to put the following code on a new line, for legibility's sake.

    Notice the backwards slash in front of the quotes for the charset string too. You need to do that because PHP will get confused, and the headers will end right where 'UTF-8' starts. The backward slash escapes it and tells PHP it's a literal character.

  7. #6
    Member AllenP's Avatar
    Join Date
    Jul 2005
    Location
    Perris,CA
    Posts
    55
    Member #
    10453
    Thank You, I have it working now, although not in gmail.

  8. #7
    ljm
    ljm is offline
    Senior Member ljm's Avatar
    Join Date
    Aug 2006
    Location
    Manchester, England
    Posts
    284
    Member #
    13684
    Liked
    1 times
    Hmmmm...well my own script uses the method I posted (minus the charset bit), and it shows up fine in Gmail. I had images and links in mine.

    Try it after deleting the charset from your script.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 11:43 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com