Jump to content

php array to email body,,,separate lines


walkerwilly77

Recommended Posts

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

Link to comment
Share on other sites

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="

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.