Here is the code so far, I have left out the fields array() which I just commented out just now in original script as I want to use a table to display the form fields data instead in the email that comes back to me.
Thanks for looking because i'm spending days going out of my mind here not understanding what is going on.
Code:
<?php
$to = ( isset ($_REQUEST['sendto']) ? $_REQUEST['sendto'] : "default 'to' email goes here" );
$from = ( isset ($_REQUEST['Email']) ? $_REQUEST['Email'] : "default 'from' email goes here" ) ;
$name = ( isset ($_REQUEST['Member_Name']) ? $_REQUEST['Member_Name'] : "Default member name goes here" ) ;
$headers = "From: $from";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=utf-8\n";
$subject = "Members Data From ......";
$body = "Robert.........details..... .com:<br /><br />";
$body .= "<table align=left>";
$body .= "<tr>";
$body .= "<td width=\"200px\">Member Name</td><td width=\"200px\"> {$_POST['Member_Name']} </td><td width=\"200px\"></td><td width=\"200px\"></td>";
$body .= "</tr><tr>";
$body .= "<td>Members Contact Number</td><td> {$_POST['telephone']} </td>";
$body .= "</tr><tr>";
$body .= "<td>Members Email Address</td><td> {$_POST['Email']} </td>";
$body .= "</tr><tr>";
$body .= "<td>Loan Amount</td><td> {$_POST['Loan_Amount']} </td>";
$body .= "</tr> <tr>";
$body .= "<td> </td>";
//applicant details
$body .= "</tr><tr>";
$body .= "<th>Main Applicant</th><td> </td><th>Joint Applicant</th>";
$body .= "</tr><tr>";
$body .= "<td>Title</td><td> {$_POST['title']} </td><td>Title</td><td> {$_POST['title1']} </td>";
$body .= "</tr><tr>";
$body .= "<td>Surname</td><td> {$_POST['surname']} </td><td>Surname</td><td> {$_POST['surname1']} </td>";
$body .= "</tr><tr>";
$body .= "<td>Forname(s)</td><td> {$_POST['forename']} </td><td>Forename(s)</td><td> {$_POST['forname1']} </td>";
$body .= "</tr><tr>";
$body .= "<td>Residential Address</td><td> {$_POST['residential']} </td><td>Residential Address</td><td> {$_POST['residential1']} </td>";
$body .= "</tr><tr>";
$body .= "<td>Town</td><td> {$_POST['town']} </td><td>Town</td><td> {$_POST['town1']} </td>";
$body .= "</tr><tr>";
$body .= "<td>County</td><td> {$_POST['county']} </td><td>County</td><td> {$_POST['county1']} </td>";
$body .= "</tr><tr>";
$body .= "<td>Post Code</td><td> {$_POST['postcode']} </td><td>Post Code</td><td> {$_POST['post1']} </td>";
$body .= "</tr><tr>";
$body .= "<td>Lived At Address (Years)</td><td> {$_POST['years']} </td><td>Lived At Address (Years)</td><td> {$_POST['years1']} </td>";
$body .= "</tr><tr>";
$body .= "<td>Lived At Address (Months)</td><td> {$_POST['months']} </td><td>Lived At Address (Months)</td><td> {$_POST['months1']} </td>";
$body .= "</tr><tr>";
$body .= "<td>Home Tel No.</td><td> {$_POST['hometelephone']} </td><td>Home Tel No.</td><td> {$_POST['hometelephone1']} </td>";
$body .= "</tr><tr>";
$body .= "<td>Mobile Tel No.</td><td> {$_POST['mobile']} </td><td>Mobile Tel No.</td><td> {$_POST['mobile1']} </td>";
$body .= "</tr><tr>";
$body .= "<td>D.O.B</td><td> {$_POST['dateofbirth']} </td><td>D.O.B</td><td> {$_POST['dateofbirth1']} </td>";
$body .= "</tr><tr>";
$body .= "<td>Nationality</td><td> {$_POST['nationality']} </td><td>Nationality</td><td> {$_POST['nationality1']} </td>";
$body .= "</tr><tr>";
$body .= "<td>Sex</td><td> {$_POST['sex']} </td><td>Sex</td><td> {$_POST['sex1']} </td>";
$body .= "</tr><tr>";
$body .= "<td>Marital Status</td><td> {$_POST['marital']} </td><td>Marital Status</td><td> {$_POST['marital1']} </td>";
$body .= "</tr></table>";
$headers2 = "From: me@somewhere.co.uk";
$subject2 = "Thank-you for filling in the Form ";
$autoreply = "Somebody from.. will get back to you as soon as possible, Thank-you";
if($from == '') {print "You have not entered an Email Address, please go back and try again";}
else {
if($name == '') {print "You have not entered a First Name, please go back and try again";}
else {
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
if($send){header( "Location: http://www....k/r..../thankyou.html" );}
else
{print "We encountered an error sending your mail, please notify webmaster@me.co.uk"; }
}
}
?>
It gets to this line and if I enter a post-code in the form in both fields it posts only one post-code and ignores the script from there on in
Code:
$body .= "<td>Post Code</td><td> {$_POST['postcode']} </td><td>Post Code</td><td> {$_POST['post1']} </td>";
Tha actual form has a lot more code to go in but at this stage it fails me.
Bookmarks