Jump to content

Recommended Posts

 

Hi I hope somone can just help me bring this to work.

 

In a web form i added a multiple select option like so:

 

<select name="product[]" multiple="multiple"

...>

 

in the php file that sends the info to my email i simply added this:

 

$product = $_POST['product'];

 

to the $body i simply added $product

 

$body = " Name - $ime \n \n \n Business - $business \n \n \n Email Address - $email \n \n \n Print Product(s) - $products.[] \n \n \n  Budget - $budget \n \n \n Comment - $comment \n \n \n IP - $ip";

 

that obviously does not work. i am sure i need to loop in an array but have no idea how to so i added this:

 

$products = array(
'product1' => 'product1',
'product2' => 'product2',
................
);

 

what's next? can someone help me PLEASE?

Link to comment
https://forums.phpfreaks.com/topic/179900-multiple-select-options-to-email/
Share on other sites

concatenate a string.

$products = "";
foreach($_POST['product'] as $product) 
{
$products .= $products . " ";
}

 

that will put your products in a line with each one seperated by a space, IE

shirt pants dog cat sandwhich.

 

you could then use the $products variable in your body

mikesta707 i really do thank you but it does not work!

 

let me just repeat ok?

 

in the form i have this: select name="product[]" multiple="multiple" size="10" 

in the mail php i have this:

 

$product = $_POST['product'];

 

$products = array(

'prod1' => 'prod1',

'prod2' => 'prod2'

);

 

$products = "";

foreach($_POST['product'] as $product)

{

$products .= $products . " ";

}

 

$body = $products (this should print the products selected in the email)

 

thanks!!!!

 

 

 

 

 

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.