[英]How to send mail depending on radio button value in codeigniter?
我在我的應用程序中有一個選擇表單。在我有四個字段的地方,一個是選擇,注釋,結果,還有兩個單選按鈕,分別為selected和selected。
所以我想做的是,當某人單擊選定的單選按鈕時,我需要發送選定的郵件。如果選定的人未選定的單選按鈕,則需要發送未選定的郵件。
我的控制器代碼:
public function requirement()
{
$this->load->model('RequirementModel');
$data['user'] = $this->RequirementModel->getusers();
$this->load->view('Requirements/requirements', $data);
$insert = array(
'role_name' => $this->input->post('role_name'),
'vacancies' => $this->input->post('vacancies'),
'experience' => $this->input->post('experience'),
'jd' => $this->input->post('jd'),
'hiring_contact_name' => $this->input->post('hiring_contact_name'),
'hiring_contact_number' => $this->input->post('hiring_contact_number'),
'user_id' => implode(',', $this->input->post('user_id')),
);
$this->RequirementModel->add_requirement($insert);
$all_users = $this->input->post('user_id');
foreach ($all_users as $key) {
$get_email = $this->RequirementModel->get_user_email_by_id($key);
$role_name = $this->input->post('role_name');
$vacancies = $this->input->post('vacancies');
$experience = $this->input->post('experience');
$jd = $this->input->post('jd');
$hiring_contact_name = $this->input->post('hiring_contact_name');
$hiring_contact_number = $this->input->post('hiring_contact_number');
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://md-in-42.webhostbox.net',
'smtp_port' => 465,
'smtp_user' => 'test3@clozloop.com',
'smtp_pass' => 'test3',
);
$this->load->library('email', $config);
$this->email->set_mailtype("html");
$this->email->from('test3@clozloop.com', 'bharathi');
$this->email->to($get_email);
$this->email->subject('this is our requirements pls go through it');
$link = 'Click on this link - <a href="http://localhost/job_portal/index.php/Login/signin">Click Here</a>';
$this->email->message($link);
// $this->email->message("Dear,\n\nRole Name:$role_name, Vacancies:$vacancies,experience:$experience,jd:$jd,hiring_contact_number:$hiring_contact_number,hiring_contact_name:$hiring_contact_name.\n\nThanks, \nGlobaalign.");
//$this->email->send();
//print_r($get_email);
if ($this->email->send()) {
echo "email sent";
} else {
echo "email failed";
}
}
請幫我怎么做..
謝謝
解決方法如下:
如果($數據[ 'selection_process'] == 1)
{
//發送選定的郵件
}
其他
{
//發送未選擇的郵件
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.