walkerwilly77 Posted January 29, 2013 Share Posted January 29, 2013 can you one of the php master can help me out with this this is my array output Array ( [0] => WI BLACK CHERRY BASE [1] => 1 [2] => WI STRAWBERRY BASE [3] => 1 ) this is the buttom I am using to past the value <form id="form1" name="form1" method="post" action="/storescripts/mailcart.php"> <input type="hidden" name="message" id="message" value="<?php echo $mail_id_array; ?>" /> <input type="submit" name="button" id="button" value="Send Order" /> </form> this is the mailcart.php <?php $message = ''; $name = "wesrt"; $email = "abc@hotmail.com"; $message .= $_POST[message]; $formcontent=" From: $name \n Message: $message"; $recipient = "info@xsn.com"; $subject = "Order Form"; $mailheader = "From: $email \r\n"; //mail($recipient, $subject, $formcontent, $mailheader) or die("Error!"); mail($recipient, $subject, $message, $mailheader) or die("Error!"); print_r($message); //header( 'Location: http://www.xsn.com/index.php' ) ; //echo "Thank You!"; ?> I am getting this: WI BLACK CHERRY BASE .--->.1<br>WI STRAWBERRY BASE .--->.1<br> and I would like to have the following result: WI BLACK CHERRY BASE .--->.1 WI STRAWBERRY BASE .--->.1 Quote Link to comment https://forums.phpfreaks.com/topic/273775-php-array-to-email-bodyseparate-lines/ Share on other sites More sharing options...
Muddy_Funster Posted January 29, 2013 Share Posted January 29, 2013 (edited) I dont see anything in that code that sets the content type as html, or anything else for that matter. You don't show any other html deffinitions or tags. If you want to send html mails you need to set the content-type and form the page properly. Edt: typo Edited January 29, 2013 by Muddy_Funster Quote Link to comment https://forums.phpfreaks.com/topic/273775-php-array-to-email-bodyseparate-lines/#findComment-1408911 Share on other sites More sharing options...
walkerwilly77 Posted January 29, 2013 Author Share Posted January 29, 2013 thanks for the fast response ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //this is my cart page cart.php here I do render my dynamic cart table wich is the values i want to have in my email body separated in diferent lines //I delete some of the top code because i do not want to give you innecessary code to read but workss //in the html body you will find the buttom I do use to send the value to my cartemail.php ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// <?php session_start(); // Start session first thing in script // Script Error Reporting error_reporting(E_ALL); ini_set('display_errors', '1'); // Connect to the MySQL database include "storescripts/connect_to_mysql.php"; ?><p><?php ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Section 5 (render the cart for the user to view on the page) ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $cartOutput = ""; $cartTotal = ""; $quantity = ""; $pp_checkout_btn = ''; $product_id_array = ''; $mail_id_array = ''; $sentoemail=array(); if (!isset($_SESSION["cart_array"]) || count($_SESSION["cart_array"]) < 1) { $cartOutput = "<h2 align='center'>Your shopping cart is empty</h2>"; } else { // Start PayPal Checkout Button $pp_checkout_btn .= '<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_cart"> <input type="hidden" name="upload" value="1"> <input type="hidden" name="business" value=" Quote Link to comment https://forums.phpfreaks.com/topic/273775-php-array-to-email-bodyseparate-lines/#findComment-1409010 Share on other sites More sharing options...
walkerwilly77 Posted January 29, 2013 Author Share Posted January 29, 2013 I am new at this forums thing the prevuis post did not paste in full so here it is the attached doc, thanksphparraytoemail.txt Quote Link to comment https://forums.phpfreaks.com/topic/273775-php-array-to-email-bodyseparate-lines/#findComment-1409012 Share on other sites More sharing options...
Muddy_Funster Posted January 30, 2013 Share Posted January 30, 2013 you still don't seem to be setting any content-type in the mail header. also, unless $_POST[message'] contains the standard <html><head><body> tag layout as well as your array data, you are also still not building the page properly. Please use code tags when posting code in the forum, and try to avaid linking to files as most people will not follow links from stangers. Quote Link to comment https://forums.phpfreaks.com/topic/273775-php-array-to-email-bodyseparate-lines/#findComment-1409114 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.