简体   繁体   中英

How to send mail depending on radio button value in codeigniter?

I have one selection form in my application..in that i have four fields one is selection,comments,results,and two radio buttons with selected and selected..

So what I want to do is when person clicked on the selected radio button I need to send selected mail..if person selected not selected radio button need to send mail not selected mail..

My Controller code :

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

please help me how to do this..

Thank you

Here is the solution:

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

{

//send selected mail

}

else

{

//send not selected mail

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM