【问题标题】:How to send mail depending on radio button value in codeigniter?如何根据codeigniter中的单选按钮值发送邮件?
【发布时间】:2017-06-27 05:51:58
【问题描述】:

我的应用程序中有一个选择表单。我有四个字段,一个是选择、cmets、结果,以及两个带有已选择和已选择的单选按钮。

所以我想要做的是当人们点击选定的单选按钮时,我需要发送选定的邮件..如果人选择未选择的单选按钮需要发送邮件而不是选定的邮件..

我的控制器代码:

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";
            }
        }

请帮助我如何做到这一点..

谢谢

【问题讨论】:

  • 也添加您的视图
  • 我得到了答案..谢谢您的回复

标签: javascript php jquery codeigniter email


【解决方案1】:

解决办法如下:

if($data['selection_process']==1)

{

//发送选中的邮件

}

其他

{

//发送未选中的邮件

}

【讨论】:

    猜你喜欢
    • 2013-03-23
    • 1970-01-01
    • 2013-02-19
    • 2017-07-13
    • 1970-01-01
    • 2021-04-14
    • 1970-01-01
    • 1970-01-01
    • 2018-06-03
    相关资源
    最近更新 更多