Sending emails from a database

I’m currently working on a site that allows clients to order lab materials from it. I’ve already completed the ordering part and it works, but now I need to send a copy of the order (all the info is stored in the database) to the client’s email and to the site administrator (I’m making this for someone else). I’ve read about php mail, but I haven’t found anything explicit about reading information from a database to use as the message in the email. Any help would be greatly appreciated. :slight_smile:

Surely you can just send the mail on submit from the ordering form.

[code]

blahblah $_POST=[“your fields”]

if( empty($errors))
{
$to = $myemail;
$email_subject = “Orde made: $emailj”;
$email_body = "You have completed an order. ".
"\n \n Here is your order confirmation email. \n \n Here are the details \n Telescope: $scope \n Plug: $plug etc… ";

$headers = "From: $myemail"; 
$headers .= "Order Made: $emailj";

mail($to,$email_subject,$email_body,$headers);
//redirect to the 'thank you' page
header ("Location: http://www.???????.html");[/code]
Sponsor our Newsletter | Privacy Policy | Terms of Service