Hi all,
I am just starting out in the world of php and have got this far with a lot of googling. But I'm really stuck with this part now.
I have a function that works perfectly for display on a page, eg <?php echo quickquote(); ?>
function quickquote() {
global $db;
global $cart;
$cart = $_SESSION['cart'];
if ($cart) {
$items = explode(',',$cart);
$contents = array();
foreach ($items as $item) {
$contents[$item] = (isset($contents[$item])) ? $contents[$item] + 1 : 1;
}
$quickquote[] = 'Quote Required:<br />';
foreach ($contents as $id=>$qty) {
$sql = 'SELECT * FROM products WHERE id = '.$id;
$result = $db->query($sql);
$row = $result->fetch();
extract($row);
$quickquote[] = ''.$qty.'';
$quickquote[] = ' x ';
$quickquote[] = '' . $model . '';
$quickquote[] = ' (' . $type . '- ';
$quickquote[] = ''. $basin . '- ';
$quickquote[] = ''. $top . ')';
$quickquote[] = '<br />';
}
$quickquote[] = 'End of Quick Quote Request';
} else {
$quickquote[] = 'The quote cart is empty.';
}
return join('',$quickquote);
}
However, i am trying to include this in an email message:
if(!$error)
{
$messages="From: $email <br>";
$messages.="Name: $name <br>";
$messages.="Email: $email <br>";
$messages.="Phone: $phone <br>";
$messages.="Message: $message <br>";
$messages.="Quick Quote Request: $quickquote <br>";
$mail = mail($to,$subject,$messages,$headers);
The email also works perfectly with the exception that the data is not there from $quickquote.
I've tried all sorts of variations and suggested solutions from the web but nothing I've tried has been successful so far.
It's amazing that I've got this far so I don't want to give up on it, but I'm just completely stumped ...
All information and help very much appreciated.
Cheers
K