Esempio n. 1
0
 public function save_recipient()
 {
     $names = $this->input->post("names");
     $emails = $this->input->post("emails");
     $existing_recipients = Email_Recipients::getAll();
     //First delete all the existing plans
     foreach ($existing_recipients as $existing_recipient) {
         $existing_recipient->delete();
     }
     //Then add the new Plans
     $counter = 0;
     foreach ($names as $name) {
         if (strlen($name) > 2) {
             $recipient = new Email_Recipients();
             $recipient->Name = $names[$counter];
             $recipient->Email = $emails[$counter];
             $recipient->save();
             $counter++;
         } else {
             continue;
         }
     }
     redirect("report_management");
 }