I have a php-based form mailer tied to a rather lengthy service order form, and was wondering if there was any effective way to manage the output from the form mailer so it's all laid out in an easy-to-read structure, like a table, perhaps? If I need to clarify at all, or provide a sample of my code, please let me know.

Thanks in advance for any advice,

- Devin

Recommended Answers

All 3 Replies

It's probably best if you provide a sample of the code; it lets us see exactly how you do things and give you better advice.

Sorry this took so long, but I was enjoying the holiday weekend. Anyway, here's the basics of my code:

<?php
$replyemail="email@email.com";
$subject="Subject";
$valid_ref1="http://domain.com/";
$valid_ref2="http://www.domain.com/";

if (!isset($_POST['contact_email']))
{
 echo "<script language=\"JavaScript\"><!--\n ";
 echo "top.location.href = \"$valid_ref1\"; \n// --></script>";
 exit;
}

$ref_page=$_SERVER["HTTP_REFERER"];
$valid_referrer=0;
if($ref_page==$valid_ref1) $valid_referrer=1;
elseif($ref_page==$valid_ref2) $valid_referrer=1;
if(!$valid_referrer)
{
 echo "<script language=\"JavaScript\"><!--\n alert(\"ERROR - not sent.\\n\\nCheck your 'valid_ref1' and 'valid_ref2' are correct within form.php.\");\n";
 echo "top.location.href = \"formpage.html\"; \n// --></script>";
 exit;
}

$contact_name = ($_POST["contact_name"]);
$contact_phone_number = ($_POST["contact_phone_number"]);
$contact_email = ($_POST["contact_email"]);

$other_variables_from_form = ($_POST["other_variables_from_form"]);

$checkbox_variables = implode("\r",$_POST["checkbox_variables"]);

$success_sent_msg="";

$replymessage = "Hello $contact_name,  here's your confirmation";

$body = "\r
Contact name: $contact_name\n
Phone: $contact_phone_number\n
Email: $contact_email\n
\r
$other_variables_from_form\n
\r
$checkbox_variables\n
\r";

mail("$replyemail",
       "$subject",
       "$body",
       "$From: $contact_email");
mail("$contact_email",
       "$Receipt: $subject",
       "$replymessage",
       "From: $replyemail\nReply-To: $replyemail");
echo $success_sent_msg;
include ('confirmation.html');

?>

Bear in mind, it's a bit more complex than this. I've got a long list of text fields, radio buttons, and checkboxes I'm gathering information from. The output is going to be read by others that will need to be able to make sense of it, and quickly. If it's even possible, I'd like to be able to put the output into a table within the email that goes out to those people, for easier reading.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.