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?
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!
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.
Yes. You can. Just need to send the correct headers, here's a shameless self promotion for one of my Mail Classes. http://forums.digitalpoint.com/showthread.php?t=1157198