我的应用程序中有一个需求表单,在该表单中,当用户插入需求然后提交时,我会向特定供应商发送电子邮件。
我想做的是,当供应商看到这个要求时,我想 将状态自动从0更改为1.
我的代码是:
public function requirement()
{
$data["msg"]="";
$this->load->model('RequirementModel');
$data['user']=$this->RequirementModel->getusers();
$data['rolename']=$this->RequirementModel->getrolename();
if($this->input->post())
{
$this->RequirementModel->add_requirement($this->input->post());
$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);
print_r($get_email);
if($this->email->send())
{
echo "email sent";
}
else
{
echo "email failed";
}
}
}
$this->load->view('Requirements/requirements',$data);
}
我不知道该怎么做。任何人都可以帮助我吗?
答案 0 :(得分:1)
您可以将发送给供应商的链接中的需求ID作为查询字符串发送。 例如 -
$link = 'Click on this link -
<a href="http://localhost/job_portal/index.php/Login
/signin?requirement_id=1">Click Here</a>';
现在您的登录功能更新要求ID如下 -
function signin()
{
if( isset( $_GET['requirement_id'] ) )
{
// update requirement column here
$this->db->where( array( 'requirement_id' => $_GET['requirement_id'] ) );
$this->db->update( 'requirement', array( 'status' => '1' ) );
}
// your sign in code here
}
现在,只要供应商点击链接,就会更新特定需求状态的日志。