I need to send an email that contains data from a $_SESSION
I have this array:
Array (
[libelleProduit] => Array
( [0] => MN 25551 [1] => WHX 4509 [2] => TV15751 [3] => BO22451 )
[qteProduit] => Array
( [0] => 1 [1] => 2 [2] => 6 [3] => 1 )
[prixProduit] => Array
( [0] => 189 [1] => 206 [2] => 530 [3] => 375 )
How can I loop through this array to get all the data sent? I need to be able to send something like this:
ref : MN 25551 quantity: 1 price: 189
ref : WHX 4509 quantity : 2 price : 206
ref : TV15751 quantity : 6 price : 530
ref : BO22451 quantity : 1 price : 375
$data = '';
$info = [
'libelleProduit' => [
0 => 'MN 25551',
1 => 'WHX 4509',
2 => 'TV15751',
3 => 'BO22451',
],
'qteProduit' => [
0 => 1,
1 => 2,
2 => 6,
3 => 1,
],
'prixProduit' => [
0 => 189,
1 => 206,
2 => 530,
3 => 375,
],
];
foreach($info['libelleProduit'] as $key => $val) {
$data .= 'ref : ' . $val . ' quantity: ' . $info['qteProduit'][$key] . ' price: ' . $info['prixProduit'][$key] . "
";
}
mail($to , $subject, $data);