Hello all,
I have a multi record table, which includes the field 'email_address', and have a display page showing this:
<?php foreach ($contactsRecords as $record): ?>
<?php echo $record['email_address'] ?>
<?php endforeach; ?>
I need to be able to assign the output to a new variable, such as:
$allemails = email@email.com, email2@email.com, email3@email.com
So I can then on a subsequent page display:
"email@email.com, email2@email.com, email3@email.com".
I need to assign it to the new varaible ($allemails) so it can indeed be displayed/posted into a subsequent page.
The code
<?php $recipients = '<?php foreach ($contactsRecords as $record): ?><?php echo $record['email_address'] ?><?php endforeach; ?>' ?>
Is the principle, but obviously doesn't work as I'm trying to put <?php> tags within already open <?php> tags.
I've tried it cutting out the second set of tags, but still doesn't work.
So i'm not sure if it's just a slight error with my line, or i'm barking up the wrong tree...
I touched in the Concatenation idea, but not sure how to make it concatenate FOREACH.
Any ideas/thoughts would be most appreciated.
Many thanks
Rob