Hi,
I am trying to find the syntax to write code that sends a confirmation email in the final stage of ordering. I'm also trying to make the program send the email to the address the user supplied in an earlier stage of the checkout process, this email address is stored in the mysql database 'email'.
Here is what I have so far. I would rather the code was not in an if statement(because I'm allready putting it in a seperate if statement. I'm also not sure of the syntax in the $to variable (where the address is stored):
$to = ($row['email']);
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
Here is where I am putting the email code(so you can see why I would rather it not be a seperate if statement:
if ($approved == 'Y') {
// Send an email.
$to = ($row['email']);
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
echo 'thank you for your order'
} else {
echo 'your order could not be place'
}
Any help would be greatly appreciated.