How we can put loop in a mail message in php????

Reply

Join Date: Feb 2009
Posts: 130
Reputation: gagan22 is an unknown quantity at this point 
Solved Threads: 0
gagan22 gagan22 is offline Offline
Junior Poster

How we can put loop in a mail message in php????

 
0
  #1
Apr 23rd, 2009
Hi Everyone,

I am working on a shopping cart. In which i am sending mail which product customer want to shop. But i am ubable to fetch more than one product with different name . Because for this i need a loop. And i am not understanding how i can call a loop or array in mail message.Like i want message should go in this way:


Thanks for shopping with us. You have placed order of these products:-----
1st Product Name: ----name--
Prodcut price:----price1 value--
Prodcut quantity:---quantity---
2nd Product Name:----name---
Prodcut price:----price2 value--
Prodcut quantity:---quantity---
3rd Product Name:----name---
Prodcut price:----price3 value--
Prodcut quantity:---quantity---


Total price of these all product: price1+price2+price3
Postage Charge:------value--------
Total:---------total price+postage charge
If you have any query about your order placed or for further Convenience, you can contact us or call us here:-

---------------address information---------


So here i am unable to fetch these three product information in mail which customer is receiving through shopping cart . It is fetching only last one product info which customer is adding in cart and it is showing only that product.

Please suggest me . How i can do this. It is very urgent for me.
thanks,
gagan
Last edited by gagan22; Apr 23rd, 2009 at 4:44 am.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,748
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 331
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: How we can put loop in a mail message in php????

 
0
  #2
Apr 23rd, 2009
Build the values first and add it in the message part of the mail..
Something like this,
  1. <?php
  2. foreach($product as $value) {
  3. $message .= $value ." is in the cart.<br />";
  4. }
  5. mail("someuser@gmail.com","Welcome",$message,"From: someone@gmail.com");
  6. ?>
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 37
Reputation: shefeekj has a little shameless behaviour in the past 
Solved Threads: 2
shefeekj shefeekj is offline Offline
Light Poster

Re: How we can put loop in a mail message in php????

 
0
  #3
Apr 23rd, 2009
yes..Make a string first with all the values u have using the looping structure in php ..And then send that string
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC