PHP Programming > General PHP Help
Error in Form Hanlder
(1/1)
bmccarthy:
Okay. I've been able to get this php form handler to send me the emails...everything is right expect for 1 thing...
Everything except this line appears correctly in the form.
--- PHP Code: ---$message .= "<tr style='background: #eee;'><td><strong>Auto-Settlement</strong></td><td>" . strip_tags($_POST['Settle']) . "</td><td><strong>Time</strong></td><td>" . strip_tags($_POST['Time']) . "</td></tr>";
--- End code ---
it ends up throwing the last value (" . strip_tags($_POST['Settle']) . ") at the very top of the email, and not within the message body where it should be placed....any ideas....or can someone debug.
I've used the following website, but it says the code has no errors:
http://www.meandeviation.com/tutorials/learnphp/php-syntax-check/v4/syntax-check.php
Complete code below
--- PHP Code: ---<?php
$to = 'me@domain.com';
$subject = 'Setup Sheet';
$url = 'http://www.domain.com/confirmation.html';
$headers = "From: sales@domain.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message = '<html><body>';
$message .= '<table width="600" style="border-color: #eee;" border="1" cellspacing="0" cellpadding="0">';
$message .= "<tr style='background: #ccc;'><th colspan='4'><strong>New Account Setup</strong></th></tr>";
$message .= "<tr style='background: #eee;'><td><strong>Rep Name</strong></td><td>" . strip_tags($_POST['ISRName']) . "</td><td><strong>Support Mgr Number</strong></td><td>" . strip_tags($_POST['SupMgrNum']) . "</td></tr>";
$message .= "<tr style='background: #eee;'><td><strong>ISR Bank ID</strong></td><td>" . strip_tags($_POST['BankID']) . "</td><td><strong>Number of Locations</strong></td><td>" . strip_tags($_POST['Locations']) . "</td></tr>";
$message .= "<tr style='background: #eee;'><td colspan='4'> </td></tr>";
$message .= "<tr style='background: #ccc;'><th colspan='4'><strong>Contact Details</strong></th></tr>";
$message .= "<tr style='background: #eee;'><td><strong>Contact Name</strong></td><td>" . strip_tags($_POST['Contact']) . "</td><td><strong>Contact Phone</strong></td><td>" . strip_tags($_POST['CntPh']) . "</td></tr>";
$message .= "<tr style='background: #eee;'><td><strong>Company Name</strong></td><td>" . strip_tags($_POST['Company']) . "</td><td><strong>Company Phone</strong></td><td>" . strip_tags($_POST['CmpPh']) . "</td></tr>";
$message .= "<tr style='background: #eee;'><td colspan='4'> </td></tr>";
$message .= "<tr style='background: #ccc;'><th colspan='4'><strong>Shipping/Terminal Information</strong></th></tr>";
$message .= "<tr style='background: #eee;'><td colspan='1'><strong>Address</strong></td><td colspan='3'>" . strip_tags($_POST['Address']) . "</td></tr>";
$message .= "<tr style='background: #eee;'><td><strong>City</strong></td><td>" . strip_tags($_POST['City']) . "</td><td><strong>State: </strong>" . strip_tags($_POST['State']) . "</td><td><strong>Zip: </strong>" . strip_tags($_POST['Zip']) . "</td></tr>";
$message .= "<tr style='background: #eee;'><td><strong>Installation Type</strong></td><td>" . strip_tags($_POST['Install']) . "</td><td><strong>Setup Type</strong></td><td>" . strip_tags($_POST['Setup']) . "</td></tr>";
$message .= "<tr style='background: #eee;'><td><strong>Terminal Type</strong></td><td>" . strip_tags($_POST['Term']) . "</td><td><strong>Pinpad Encryption</strong></td><td>" . strip_tags($_POST['PPEnc']) . "</td></tr>";
$message .= "<tr style='background: #eee;'><td><strong>Connection Type</strong></td><td>" . strip_tags($_POST['Connect']) . "</td><td><strong>PABX</strong></td><td>" . strip_tags($_POST['Connect2']) . "</td></tr>";
$message .= "<tr style='background: #eee;'><td><strong>Auto-Settlement</strong></td><td>" . strip_tags($_POST['Settle']) . "</td><td><strong>Time</strong></td><td>" . strip_tags($_POST['Time']) . "</td></tr>";
$message .= "<tr style='background: #eee;'><td colspan='1'><strong>Default Report</strong></td><td colspan='3'>" . strip_tags($_POST['Report']) . "</td></tr>";
$message .= "<tr style='background: #eee;'><td><strong>Tips Processing?</strong></td><td>" . strip_tags($_POST['Tips']) . "</td><td><strong>Server IDs?</strong></td><td>" . strip_tags($_POST['ServerIDs']) . "</td></tr>";
$message .= "<tr style='background: #eee;'><td colspan='1'><strong>Install Notes:</strong></td><td colspan='3'>" . strip_tags($_POST['NotesIns']) . "</td></tr>";
$message .= "<tr style='background: #eee;'><td colspan='4'> </td></tr>";
$message .= "<tr style='background: #ccc;'><th colspan='4'><strong>Underwriting Information</strong></th></tr>";
$message .= "<tr style='background: #eee;'><td><strong>Is this a Reapp?</strong></td><td>" . strip_tags($_POST['Reapp']) . "</td><td><strong>Original MID</strong></td><td>" . strip_tags($_POST['RMID']) . "</td></tr>";
$message .= "<tr style='background: #eee;'><td><strong>Add Location?</strong></td><td>" . strip_tags($_POST['AddLoc']) . "</td><td><strong>Original MID</strong></td><td>" . strip_tags($_POST['AMID']) . "</td></tr>";
$message .= "<tr style='background: #eee;'><th colspan='4';><align='right'><strong>CheckList</strong></td></tr>";
$message .= "<tr style='background: #eee;'><td><strong>Voided Check?</strong></td><td>" . strip_tags($_POST['Check2']) . "</td><td><strong>Signature and Initials</strong></td><td>" . strip_tags($_POST['SigInit']) . "</td></tr>";
$message .= "<tr style='background: #eee;'><td><strong>Debit Verified?</strong></td><td>" . strip_tags($_POST['Debit2']) . "</td><td><strong>Pinpad?</strong></td><td>" . strip_tags($_POST['Pinpad']) . "</td></tr>";
$message .= "<tr style='background: #eee;'><td><strong>Tax ID Verified?</strong></td><td>" . strip_tags($_POST['TaxID']) . "</td><td><strong>Tax ID Number</strong></td><td>" . strip_tags($_POST['txid']) . "</td></tr>";
$message .= "<tr style='background: #eee;'><td><strong>Equipment Paperwork?</strong></td><td>" . strip_tags($_POST['EqpPpw2']) . "</td><td><strong>Avg Ticket/Volume?</strong></td><td>" . strip_tags($_POST['AvgTktVol']) . "</td></tr>";
$message .= "<tr style='background: #eee;'><td><strong>MSA/Lead Sheet Attached?</strong></td><td>" . strip_tags($_POST['MSA2']) . "</td><td><strong>Equipment Indicated?</strong></td><td>" . strip_tags($_POST['EquipType']) . "</td></tr>";
$message .= "<tr style='background: #eee;'><td><strong>Existing AmEx #?</strong></td><td>" . strip_tags($_POST['ExstAmex']) . "</td><td><strong>Amex #</strong></td><td>" . strip_tags($_POST['Amex']) . "</td></tr>";
$message .= "<tr style='background: #eee;'><td colspan='1'><strong>Application Completed?</strong></td><td colspan='3'>" . strip_tags($_POST['CmptApp']) . "</td></tr>";
$message .= "<tr style='background: #eee;'><td colspan='4'> </td></tr>";
$message .= "<tr style='background: #eee;'><td><strong>Merchant Type</strong></td><td>" . strip_tags($_POST['RadioGroup1']) . "</td><td><strong>Surcharge Table</strong></td><td>" . strip_tags($_POST['RadioGroup2']) . "</td></tr>";
$message .= "<tr style='background: #eee';><td colspan='1'><strong>Dues/Assmnts?</strong></td><td colspan='3'>" . strip_tags($_POST['dues']) . "</td></tr>";
$message .= "<tr style='background: #eee';><td colspan='1'><strong>Underwriting Notes:</strong></td><td colspan='3'>" . strip_tags($_POST['NotesUnd']) . "</td></tr>";
$message .= "<tr style='background: #eee';><td colspan='4'> </td></tr>";
$message .= "<tr style='background: #ccc';><th colspan='4'><strong>End of Sheet - New Account Setup</strong></th></tr>";
mail($to, $subject, $message, $headers);
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>
--- End code ---
Smokey PHP:
Syntax of that line doesn't look wrong. You aren't closing the table though, could just be an HTML compilation error on the email client's part. Make sure the HTML you're echoing is valid.
bmccarthy:
I've tested the email in both thunderbird and outlook, and they both have the same issues. I'll try closing the table and see if that works.
bmccarthy:
Closing the table seems to have done the trick. Thanks!
Navigation
[0] Message Index
Go to full version