I've been trying to send an e-mail that containt html code generated by php.
The context is, I'm using php to generate a webpage, and I'm trying to send this webpage by e-mail by copying the code I used to generate the webpage, and putting in a message using mail function.
I found a way to generate an e-mail that contains php variables like the following example :
[...]
$message = "<address>
<strong>Adresse de livraison:</strong><br>
$prenom $nom<br>
$adress1<br>
$adress2<br>
$postalcode $ville, $country
</address>";
mail($destinataire, $objet, $message, $headers);
[...]
Everything was perfect and the e-mail was send correctly.
But now my code contain php parts like the following example :
if ($disque!= 'No') {
<tr>
<td>Disque avant : $disque</td>
<td class='text-center'>
$selected_product[] = $disqueav;
$data = bdd_select('SELECT Price FROM products WHERE Nom = ?', $selected_product);
echo $data['0']['Price'] . '€';
$subtotalprice = $data['0']['Price'] + $subtotalprice;
</td>
<td class='text-center'>1</td>
<td class='text-right'> $data['0']['Price'] . '€';</td>
</tr>
}
And it doesn't work because of the array like $data['0'], even if I'm using single comma for it, and double comma for the $message variable.
I get this error :
Parse error: syntax error, unexpected ']', expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING)
My question is, is there a way to write this part of code so I don't get any error and I can send the page exactly the way I saw it.
Thank you very much.