vassili Posted February 12, 2008 Share Posted February 12, 2008 i've looked everywhere online, and every guide seems to tell you how to set it up but not really tell you how the execution is nailed down. so i have a whole bunch of variables from a form via post. one variable, $order is a large querystring of HTML. it looks like this. <table align=\"center\" cellpadding=\"0\" border=\"0\"><tr><td><form action=\"cart.php?action=update\" method=\"post\" id=\"cart\"><table align=\"center\" cellpadding=\"10\" width=\"820\" border=\"0\"><tr><td style=\"border:1px solid #999;\"><a href=\"cart.php?action=delete&id=CSFT03CHI\" class=\"r\">Remove</a></td><td width=\"400\" style=\"border:1px solid #999;\">Men\'s 1/4 Zip Half Sleeve Pullover (albatross) in CHARCOAL/IVORY</td><td style=\"border:1px solid #999;\">$18.00</td><td width=\"50\" style=\"border:1px solid #999;\"><input type=\"text\" name=\"qtyCSFT03CHI\" value=\"11\" size=\"3\" maxlength=\"3\" /></td><td style=\"border:1px solid #999;\">$198.00</td></tr></table><p align=\"right\">Subtotal: <strong>$198.00</strong></p><div align=\"right\"><button type=\"submit\" id=\"mysubmit\">Update cart</button></div><p align=\"right\"><a href=\"memberindex.php\" >Back to Shopping...</a></p> </form></td></tr></table> the rest are simple strings to ID the sender. my submit code looks like this. <?php if(isset($_POST['submit'])) { $to = "xxx@gmail.com"; $name_field = $_POST['name']; $email_field = $_POST['email']; $message = $_POST['Comment']; $order = $_POST['order']; $subject = "New Order From $name_field"; $headers = "From: $name_field <order@xxx> \r\n"; $body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message \n $order"; echo "Data has been submitted to $to!"; mail($to, $subject, $body, $headers); } else { echo "error: mail not delivered"; } ?> how do i format this so everything in $body shows up as html correctly in the email? now i know $order doesn't pass the validation right now, but all that needs to work is for me to see the the order...i wasn't thinking ahead when i added the function that spits out the $order querystring and now it's too late to change it. Quote Link to comment https://forums.phpfreaks.com/topic/90626-html-email-via-mail/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.