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

rating

Sending email using UE4 if Tick Box is Ticked

Thread began 1/23/2012 8:39 pm by Jon Cunningham | Last modified 2/01/2012 9:46 am by Jon Cunningham | 1106 views | 5 replies |

Jon CunninghamBeta Tester

Sending email using UE4 if Tick Box is Ticked

Hi Guys I have been struggling with this for a few hours now and though that some one may give me some advice on how to do this.

I have 1 Tick box that is a repeat selection and three individual tick boxes on my update page.

My aim is to have UE4 send a specific email when a specific tick box has been ticked and updated.

For example my Repeat Selection Tick boxes relates to individual modules that a student has passed. So when a student passes say module 1 and when I palce a tick in that tick box and click update, an email will be sent congratulating them on passing module 1 and so on for each moduled passed.

I would also like to have a specific email sent when ticks are placed in specific tick boxes.

I have attached a copy of my update page so that you can see my codeing of the page which may help in answering my question.

Many thanks in advance for your time in this matter.

Jonathon

Attached Files
trainee_Update.zip
Sign in to reply to this post

Jason ByrnesWebAssist

this will take some custom coding to accomplish.

you will need to first add the universal email behavior for each possible email to send out.

then add a hidden form element next to the update button that will send how many checkboxes are present using the $RepeatSelectionCounter_1 variable for the value:

change:

php:
<input type="image" name="Update" id="Update" value="Update" alt="Update"  src="../WA_DataAssist/images/Slate/Traditional_update.gif"  />



to:

php:
<input name="totalChecks" type="hidden" id="totalChecks" value="<?php echo $RepeatSelectionCounter_1?>" /><input type="image" name="Update" id="Update" value="Update" alt="Update"  src="../WA_DataAssist/images/Slate/Traditional_update.gif"  />




now add the following code at line 1:

php:
<?php

if (isset($_POST["Update_x"])) {
    
$checked = array();
    for(
$i 0$i $_POST["totalChecks"]; $i++) {
        if(isset(
$_POST["Modules_".$i]) && $_POST["Modules_".$i] != ""$checked[] = $_POST["Modules_".$i];
    }
}
?>



this will create an array containing the IDs if the boxes that where checked. you will need to add an if statement around each Universal Email code block added to the page so that it will only trigger if the appropriate checkbox was checked.

For example, the UE code block may look like this:

php:
<?php

if (!isset($_SESSION))session_start();
if ((isset(
$_POST["Update_x"])))     {
  
//WA Universal Email object="mail"
  
set_time_limit(0);
  
$EmailRef "waue_untitled53_1";
  
$BurstSize 200;
  
$BurstTime 1;
  
$WaitTime 1;
  
$GoToPage "";
  
$RecipArray = array();
  
$StartBurst time();
  
$LoopCount 0;
  
$TotalEmails 0;
  
$RecipIndex 0;
  
// build up recipients array
  
$CurIndex sizeof($RecipArray);
  
$RecipArray[$CurIndex] = array();
  
$RecipArray[$CurIndex ][] = "test@test.com";
  
$TotalEmails += sizeof($RecipArray[$CurIndex]);
  
$RealWait = ($WaitTime<0.25)?0.25:($WaitTime+0.1);
  
$TimeTracker = Array();
  
$TotalBursts floor($TotalEmails/$BurstSize);
  
$AfterBursts $TotalEmails $BurstSize;
  
$TimeRemaining = ($TotalBursts $BurstTime) + ($AfterBursts*$RealWait);
  if (
$TimeRemaining < ($TotalEmails*$RealWait) )  {
    
$TimeRemaining $TotalEmails*$RealWait;
  }
  
$_SESSION[$EmailRef."_Total"] = $TotalEmails;
  
$_SESSION[$EmailRef."_Index"] = 0;
  
$_SESSION[$EmailRef."_Remaining"] = $TimeRemaining;
  while (
$RecipIndex sizeof($RecipArray))  {
    
$EnteredValue is_string($RecipArray[$RecipIndex][0]);
    
$CurIndex 0;
    while ((
$EnteredValue && $CurIndex sizeof($RecipArray[$RecipIndex])) || (!$EnteredValue && $RecipArray[$RecipIndex][0])) {
      
$starttime microtime_float();
      if (
$EnteredValue)  {
        
$RecipientEmail $RecipArray[$RecipIndex][$CurIndex];
      }  else  {
        
$RecipientEmail $RecipArray[$RecipIndex][0][$RecipArray[$RecipIndex][2]];
      }
      
$EmailsRemaining = ($TotalEmails$LoopCount);
      
$BurstsRemaining ceil(($EmailsRemaining-$AfterBursts)/$BurstSize);
      
$IntoBurst = ($EmailsRemaining-$AfterBursts) % $BurstSize;
      if (
$AfterBursts<$EmailsRemaining$IntoBurst 0;
      
$TimeRemaining = ($BurstsRemaining $BurstTime 60) + ((($AfterBursts<$EmailsRemaining)?$AfterBursts:$EmailsRemaining)*$RealWait) - (($AfterBursts>$EmailsRemaining)?0:($IntoBurst*$RealWait));
      if (
$TimeRemaining < ($EmailsRemaining*$RealWait) )  {
        
$TimeRemaining $EmailsRemaining*$RealWait;
      }
      
$CurIndex ++;
      
$LoopCount ++;
      
session_commit();
      
session_start();
      
$_SESSION[$EmailRef."_Index"] = $LoopCount;
      
$_SESSION[$EmailRef."_Remaining"] = round($TimeRemaining);
      
session_commit();
      
wa_sleep($WaitTime);
      include(
"webassist/email/waue_untitled53_1.php");
      
$endtime microtime_float();
      
$TimeTracker[] =$endtime $starttime;
      
$RealWait array_sum($TimeTracker)/sizeof($TimeTracker);
      if (
$LoopCount $BurstSize == 0)  {
        
$TimePassed = (time() - $StartBurst);
        if (
$TimePassed < ($BurstTime*60))  {
          
$WaitBurst = ($BurstTime*60) -$TimePassed;
          
wa_sleep($WaitBurst);
        }
        else  {
          
$TimeRemaining = ($TotalEmails$LoopCount)*$RealWait;
        }
        
$StartBurst time();
      }
      if (!
$EnteredValue)  {
        
$RecipArray[$RecipIndex][0] =  mysql_fetch_assoc($RecipArray[$RecipIndex][1]);
      }
    }
    
$RecipIndex ++;
  }
  
$_SESSION[$EmailRef."_Total"] = 0;
  
$_SESSION[$EmailRef."_Index"] = 0;
  
$_SESSION[$EmailRef."_Remaining"] = 0;
  
session_commit();
  
session_start();
  if (
$GoToPage!="")     {
    
header("Location: ".$GoToPage);
  }
}
?>



if this is the block that should trigger if ModuleID 2 is checked, add the following if statement around it:

php:
<?php if(is_array($checked) && in_array("2"$checked)) { ?>

UE CODE BLOCK HERE
<?php ?>
Sign in to reply to this post

Jon CunninghamBeta Tester

Thank you Jason for your help. I will try this and post back.

Kind regards

Jonathon

Sign in to reply to this post

Jon CunninghamBeta Tester

Hi Jason,

I have another check box with an ID of "Completed" that when ticked and update is pressed, I require an email to be sent.

Given that i have added UE to this, what else would i need code wise to make this form send on update.

Kind regards

Jonathon

Sign in to reply to this post

Jason ByrnesWebAssist

assuming that the checked value of the completed check box is "true", you could use code similar to this:

php:
<?php if(isset($_POST['completed']) && $_POST['completed'] == "true") { ?> 

UE CODE BLOCK HERE 
<?php ?>
Sign in to reply to this post

Jon CunninghamBeta Tester

Hi Jason,

Many thanks again for your help. It worked a treat.

Kind regards as always

Jonathon

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

Content

rating

Layout

rating

Ease of use

rating

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...