Php Mail Function

Discussion in 'PHP' started by Omzy, Dec 23, 2008.

  1. #1
    Basically I have a Confirmation page on my PHP Form, it displays the submitted data as follows:

    foreach($GLOBALS['attributes'] as $key => $value)
    {
    	echo '<b>'.$value.' :</b>
    	'.$_POST[$key].'<br/>';
    }
    
    foreach($_POST['selection'] as $key=>$value)
    { 
    	echo ''.$value.'<br/>';
    }
    Code (markup):
    I basically need the mail() function to email me all this data, but as it's all in a FOREACH loop this is proving to be very difficult to do. Can anybody help?
     
    Omzy, Dec 23, 2008 IP
  2. hackfanatic

    hackfanatic Peon

    Messages:
    29
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    create another variable in the loops.

    Append to that variable everytime the loop runs. finally email the contents of that variable.

    I guess that should work!
     
    hackfanatic, Dec 23, 2008 IP
  3. harrisunderwork

    harrisunderwork Well-Known Member

    Messages:
    1,005
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    135
    #3
    @above

    Correctly answered.
     
    harrisunderwork, Dec 23, 2008 IP
  4. Omzy

    Omzy Peon

    Messages:
    249
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Can you advise how I do that please?
     
    Omzy, Dec 23, 2008 IP
  5. Danltn

    Danltn Well-Known Member

    Messages:
    679
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    120
    #5
    ob_start();
    foreach($GLOBALS['attributes'] as $key => $value)
    {
    	echo '<b>'.$value.' :</b>
    	'.$_POST[$key].'<br/>';
    }
    
    foreach($_POST['selection'] as $key=>$value)
    { 
    	echo ''.$value.'<br/>';
    }
    
    $email_body = ob_get_contents();
    PHP:
    Dan.
     
    Danltn, Dec 23, 2008 IP
  6. Omzy

    Omzy Peon

    Messages:
    249
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Cheers dan.

    Do you know if you can send HTML emails using the PHP MAIL function?
     
    Omzy, Dec 23, 2008 IP
  7. Danltn

    Danltn Well-Known Member

    Messages:
    679
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    120
    #7
    Danltn, Dec 23, 2008 IP