close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


foreach in Universal Email

Thread began 10/16/2013 7:27 pm by gregoryburris330387 | Last modified 3/23/2017 1:53 pm by Ray Borduin | 720 views | 3 replies |


foreach in Universal Email

I am having formatting issues in the universal email template and cant seem to figure it out. Line 1 is giving me a error "unexpected T_FOREACH", yet in my html view it works fine...Any thoughts

$MailBody = $MailBody . foreach($speaker as $row){
$MailBody = $MailBody . "\r\n";
$MailBody = $MailBody . " <div class=\"email_content_boxes\">\r\n";

Sign in to reply to this post

Jason ByrnesWebAssist

the for each statement should not be part of the $MailBody variable , change:

$MailBody = $MailBody . foreach($speaker as $row){

foreach($speaker as $row){

Sign in to reply to this post


foreach in Universal Email - loop content not showing in email


My form includes:

<input name="docid[]" type="checkbox" id="docid[]" value="<?php echo $row_rsDocAlerts['docid']; ?>" />
<input name="title[]" type="hidden" id="title[]" value="<?php echo $row_rsDocAlerts['title']; ?>" />
<input name="meeting" type="hidden" id="meeting" value="<?php echo $row_rsMeetingList['meetingname']; ?>" />

My UE email file has this:

//Start Mail Body
$MailBody = $MailBody . "<html><head></head><body>\r\n";
$MailBody = $MailBody . "<h1>";
$MailBody = $MailBody . $_POST['meeting'];
$MailBody = $MailBody . "</h1>\r\n";
$MailBody = $MailBody . "<ul>\r\n";

foreach($_POST['docid'] as $key => $id) {
echo "<li>".($_POST['title'][$key] ."</li>");

$MailBody = $MailBody . "\r\n";
$MailBody = $MailBody . "</ul>\r\n";
$MailBody = $MailBody . "</body></html>";
//End Mail Body

The meeting value shows in the email but none of the foreach values.

If I submit the form to another page that doesn't use UE and add the foreach to its body the unordered content shows.

Any ideas?


Sign in to reply to this post


Solved! foreach in Universal Email - loop content not showing in email

This works (of course ;-):

foreach($_POST['docid'] as $key => $id) {
$MailBody = $MailBody . "<li>".($_POST['title'][$key] ."</li>");

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...