0 Replies Latest reply on Jul 11, 2013 4:25 AM by RiaandSteve1

    Multiple page form to email with sessions doesn't send mail

    RiaandSteve1

      I am creating a multiple page form where a user can apply for finance. I am trying to use session to keep the user input values and then the last page sent the application by email.

      My problem is the last step where it doen't send the email. I'm not sure if it the session I'm using is wrong because a simple form without sessions works fine.

       

      here are the forms

      First page is the input for with variables

       

      <form action="Finance_form_proposal_Address.php" method="post" >
        <span id="sprycheckbox1">
        <input  name="Disclaimer" type="checkbox" value="yes">
        <span class="checkboxRequiredMsg">Please confirm that you have read and understood the Terms and Conditions.</span></span>
        <div id="F1"><table width="100%" border="1" align="center" cellpadding="3" cellspacing="2">
        <tr>
          <td align="right" bgcolor="#F7E4F8" ><strong>Title:</strong></td>
          <td align="left" bgcolor="#F7E4F8"><select name="Title">
                <option value="Mr">Mr</option>
                <option value="Mrs">Mrs</option>
                <option value="Miss">Miss</option>
                <option value="Ms">Ms</option>
                <option value="Dr">Dr</option>
                <option value="Rev">Rev</option>
              </select></td>
      etc..
      </form>
      
      

       

      The second form:

      Getting values and input new form

      <?php session_start();
      $_SESSION['Disclaimer'] = $_POST['Disclaimer'];
      $_SESSION['Title'] = $_POST['Title'];
      $_SESSION['Forname'] = $_POST['Forname'];
      $_SESSION['Middle_name'] = $_POST['Middle_name'];
      $_SESSION['Surname'] = $_POST['Surname'];
      $_SESSION['email'] = $_POST['email'];
      $_SESSION['DOB'] = $_POST['DOB'];
      $_SESSION['DOB2'] = $_POST['DOB2'];
      $_SESSION['DOB3'] = $_POST['DOB3'];
      $_SESSION['Gender'] = $_POST['Gender'];
      $_SESSION['checkboxGroup1'] = $_POST['checkboxGroup1'];
      $_SESSION['checkboxGroup2'] = $_POST['checkboxGroup2'];
      $_SESSION['home_phone'] = $_POST['home_phone'];
      $_SESSION['mobil'] = $_POST['mobil'];
      $_SESSION['marital_status'] = $_POST['marital_status'];
      $_SESSION['Occupancy'] = $_POST['Occupancy'];
      $_SESSION['Dependants'] = $_POST['Dependants'];
      ?>
      
      
      

      Form on second page

       

      <form action="Finance_form_proposal_Bank_Details_employment.php" method="post"> <input  name="Disclaimer" type="checkbox" value="yes">
          <div id="F1"><table width="100%" border="1" align="center" cellpadding="3" cellspacing="2">
        <tr>
          <td align="right" bgcolor="#F7E4F8" ><strong>Correspondence Address:</strong></td>
          <td align="left" bgcolor="#F7E4F8"><input name="Correspondence" type="checkbox" id="Correspondence" value="yes" checked="CHECKED">
            <label for="Correspondence"></label></td>
        </tr>
        <tr>
          <td bgcolor="#F7E4F8"><strong>Street:</strong></td>
          <td bgcolor="#F7E4F8"><input name="Street" type="text"></td>
        </tr>
        <tr>
          <td bgcolor="#F7E4F8"><strong>District:</strong></td>
          <td bgcolor="#F7E4F8"><input name="District" type="text"></td>
        </tr>
        <tr>
          <td bgcolor="#F7E4F8"><strong>Town:</strong></td>
          <td bgcolor="#F7E4F8"><input name="Town" type="text"></td>
        </tr>
      
      etc ..
      </form
      
      

      Third page

      Getting values

       

      session_start();
      
      
      $_SESSION['Correspondence'] = $_POST['Correspondence'];
      $_SESSION['Street'] = $_POST['Street'];
      $_SESSION['District'] = $_POST['District'];
      $_SESSION['Town'] = $_POST['Town'];
      $_SESSION['County'] = $_POST['County'];
      $_SESSION['Country'] = $_POST['Country'];
      $_SESSION['Years'] = $_POST['Years'];
      $_SESSION['Months'] = $_POST['Months'];
      $_SESSION['Street2'] = $_POST['Street2'];
      $_SESSION['District2'] = $_POST['District2'];
      $_SESSION['Town2'] = $_POST['Town2'];
      $_SESSION['County2'] = $_POST['County2'];
      $_SESSION['Country2'] = $_POST['Country2'];
      $_SESSION['Years2'] = $_POST['Years2'];
      $_SESSION['Months2'] = $_POST['Months2'];
      $_SESSION['Street3'] = $_POST['Street3'];
      $_SESSION['District3'] = $_POST['District3'];
      $_SESSION['Town3'] = $_POST['Town3'];
      $_SESSION['County3'] = $_POST['County3'];
      $_SESSION['Country3'] = $_POST['Country3'];
      $_SESSION['Years3'] = $_POST['Years3'];
      $_SESSION['Months3'] = $_POST['Months3'];
      
      

      Then there is a another form to fill in , wont show that as it is in principle the same.

      This is the last page that should sent the data to email:

       

      <?php
      session_start();
      
      
      /* Subject mail variables */
      $emailsubject = 'Finance application from PandKshop';
      $webmaster = 'myemail@adrress.com';
      
      
      
      
      /* Gathering Data */
      $goods = $_POST['goods'];
      $amount = $_POST['amount'];
      $Total_Cash = $_POST['Total_Cash'];
      $Deposit = $_POST['Deposit'];
      $Balance = $_POST['Balance'];
      $Payments = $_POST['Payments'];
      $Diclaimer = $_SESSION['Disclaimer'];
      $Title = $_SESSION['Title'];
      $Forname = $_SESSION['Forname'];
      $Middle_name = $_SESSION['Middle_name'];
      $Surname = $_SESSION['Surname'];
      $email = $_SESSION['email'];
      $DOB = $_SESSION['DOB'];
      $DOB2 = $_SESSION['DOB2'];
      $DOB3 = $_SESSION['DOB3'];
      $Gender =  $_SESSION['Gender'];
      $CheckboxGroup1 = $_SESSION['CheckboxGroup1'];
      $CheckboxGroup2 = $_SESSION['CheckboxGroup2'];
      $home_phone = $_SESSION['home_phone'];
      $mobil_phone = $_SESSION['mobil_phone'];
      $marital_status = $_SESSION['marital_status'];
      $Occupancy = $_SESSION['Occupancy'];
      $Dependants = $_SESSION['Dependants'];
      $Correspondence = $_SESSION['Correnspondence'];
      $Street = $_SESSION['Street'];
      $District = $_SESSION['District'];
      $Town = $_SESSION['Town'];
      $County = $_SESSION['County'];
      $Country = $_SESSION['Country'];
      $Years = $_SESSION['Years'];
      $Months = $_SESSION['Months'];
      $Street2 = $_SESSION['Street2'];
      $District2 = $_SESSION['District2'];
      $Town2 = $_SESSION['Town2'];
      $County2 = $_SESSION['County2'];
      $Country2 = $_SESSION['Country2'];
      $Years2 = $_SESSION['Years2'];
      $Months2 = $_SESSION['Months2'];
      $Street3 = $_SESSION['Street3'];
      $District3 = $_SESSION['District3'];
      $Town3 = $_SESSION['Town3'];
      $County3 = $_SESSION['County3'];
      $Country3 = $_SESSION['Country3'];
      $Years3 = $_SESSION['Years3'];
      $Months3 = $_SESSION['Months3'];
      $Sort_Code          = $_SESSION['Sort_Code'];
      $Account = $_SESSION['Account'];
      $Years_with_Bank = $_SESSION['Years_with_Bank'];
      $Months_with_Bank = $_SESSION['Months_with_Bank'];
      $CreditCard = $_SESSION['CreditCard'];
      $ChequeCard = $_SESSION['ChequeCard'];
      $Employment = $_SESSION['Employment'];
      $income = $_SESSION['Income'];
      $Income2 = $_SESSION['Income2'];
      $Occupation = $_SESSION['Occupation'];
      
      
                $Body = <<<EOD
      <br><hr><br>
      Goods: $goods <br>
      Amount: $amount <br>
      Total Cash: $Total_Cash <br>
      Deposit: $Deposit <br>
      Balance: $Balance
      Nine Monthly Payments of : £ $Payments
      Title: $Title <br>
      Forname: $Forname <br>
      Middle Name: $Middle_name <br>
      Surname : $Surname <br>
      Email: $email <br>
      DOB: $DOB/$DOB2/$DOB3 <br>
      Gender: $Gender <br>
      Home_phone: $CheckboxGroup1 Mobile phone: $CheckboxGroup2 <br>
      Home Phone number: $home_phone <br>
      Mobile Phone number: $mobil_phone <br>
      Marital_Status: $marital_status <br>
      Occupancy : $Occupancy <br>
      Dependants: $Dependants <br>
      Correspondence Address: $Correspondence <br>
      Street: $Street <br>
      District: $District <br>
      Town: $Town <br>
      County: $County <br>
      Country: $Country
      Years: $Years
      Months: $Months
      Street2: $Street <br>
      District2: $District2 <br>
      Town2: $Town2 <br>
      County2: $County2 <br>
      Country2: $Country2
      Years2: $Years2
      Months2: $Months2
      Street3: $Street3 <br>
      District3: $District3 <br>
      Town3: $Town3 <br>
      County3: $County3 <br>
      Country3: $Country3 <br>
      Years3: $Years3 <br>
      Months3: $Months3 <br>
      Sort Code: $Sort_Code <br>
      Account: $Account <br>
      Years with the Bank: $Years_with_Bank <br>
      Months with the Bank: $Months_with_Bank <br>
      CreditCards: $CreditCard <br>
      Cheque Card: $ChequeCard <br>
      Employment: $Employment <br>
      Income: £$income <br>
      Income Frequency: $Income2 <br>
      Occupation: $Occupation <br>
      EOD;
      
      
                $headers = "From: $email\r\n";
                $headers .= "content-type: text/html\r\n";
                $succes = mail($webmaster, $emailsubject, $Body, $headers);
      
      
      session_destroy();
      
      
      /* Results rendered as HTML */
      $theResults = <<<EOD
      <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
      <head>
            <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
            <title>Thank you! The Piano and Keyboard Shop Online</title>
            <link rel="STYLESHEET" type="text/css" href="contact.css">
            <link href="The Piano and Keyboard Shop.css" rel="stylesheet" type="text/css" />
      </head>
      <body>
      
      
      <h2>Thanks for your application!<br />
      We endavour to get back to you as soon as possible with application results</h2>
      Please contact us on 0116 2541053 if you have any questions regarding your finance application
      Return to <a href="../index_main.php">Home Page</a>
       <div id="advertising">
          <div id="add_left"><a href="Contact.php">Contact us</a><br>
            <a href="About.php">About us</a><br>
            <a href="Finance.php">Finance</a><br>
      </div>
          <div id="adds_middle"><a href="term-conditions.php">Terms and Conditions</a><br>
            <a href="Privacy-Policy.php">Privacy Conditions</a><br>
            <a href="FAQ.php">FAQ</a><br>
      
      
      </div>
          <div id="adds_right"><a href="http://www.youtube.com/user/KeysoundWebsite">Follow us on YouTube</a><br>
            <a href="https://twitter.com/KeysoundUK">Follow us on Twitter</a><br>
            <a href="https://www.facebook.com/pages/Keysound/163590297024385">Follow us on Face book</a><br>
      </div>
          
          
        </div>
      
        
      
        
      
      
        <div id="advertising"> <div id="copy"><img src="files/Images/copyright.gif" width="19" height="22">
      </div> </div>
      </body>
      </html>
      EOD;
      echo "$theResults";
      
         
      ?>
      
      

      Is there something wrong with my sessions or just something in the code?