I have an array that collects strings of questions passed as such:
$myQuestionsPass = array ( " Question 1 passed! " );
if ( $isQ2 == Yes ) {
$myQuestionsPass[] = " Question 2 passed! " ;
}
after this array fills with the questions that passed data and filled the array, I then want to dump all the array data of $myQuestionsPass directly to the text mail and have it list in a text based email as such:
Email output- Congrats
Question 1 passed!
Question 2 passed!
and so on....
This is what I have, and it does everything, except it does not seperate each piece of data to the new next line in the text based email body…(echo and print_r return to the screen of which I don’t desire, and foreach loops all the way through, that by the time I try to pass the variable to the mail program, it just displays the last question in the array that assigned to $myQuestionsPass)
$myQuestionsPass = implode( ",",$myQuestionsPass);
my mail…
$body = "Email output- Congrats
$myQuestionsPass"
results in to a text email that looks like this:
Email output- Congrats
Question 1 passed! , Question 2 passed! , Question 3 passed! , Question 4 passed! , and so on....
instead of my desired array display of:
Email output- Congrats
Question 1 passed!
Question 2 passed!
Question 3 passed!
so on....
The newline tag and line break(br) show up as text in the email if I try to use them…
Any help would be appreciated, I have been searching on this for awhile and this was posted out of frustration! Thanks in advance for any advice!
I’m not sure I’m understanding fully but you want to output the array in an email?
How does that code not work for you? The
\nwill add newlines and the.=will concatenate the question answer to the email body.