我在应用程序中创建了一个表单。因此,每当用户刷新浏览器时。存储在数据库中的表单空值以及邮件也将在每次刷新浏览器时发送给特定的人。
这是我的看法:
<form action="" id="form" method="post" >
<div class="form-group">
<div class="form-group">
<label>Select</label>
<select class="form-control" name="selection">
<option>Telephonic</option>
<option>F2F</option>
<option>HR</option>
</select>
</div>
<div class="box-body pad">
<label>Comments</label>
<textarea class="textarea" name="comments" id="Comments "placeholder="Place comments here" style="width: 100%; height: 200px; font-size: 14px; line-height: 18px; border: 1px solid #dddddd; padding: 10px;"></textarea>
</div>
<div class="box-body pad">
<label>Results</label>
<textarea class="textarea" name="results" placeholder="Place results here" style="width: 100%; height: 200px; font-size: 14px; line-height: 18px; border: 1px solid #dddddd; padding: 10px;"></textarea>
</div>
<div class="form-group">
<label>
<input type="radio" name="selection_process" value="1" class="flat-red" checked>Selected
</label>
<label>
<input type="radio" name="selection_process" value="2" class="flat-red">Not Selected
</label>
</div>
<div class="row">
<div class="col-xs-8">
<div class="checkbox icheck">
</div>
</div>
<div class="col-xs-4">
<button type="submit" name="submit" id="submit"class="btn btn-primary btn-block btn-flat">Submit</button>
</div>
</div>
</div>
</form>
这是我的控制器:
<?php
public function add_selection()
{
$data=array(
'selection'=>$this->input->post('selection'),
'comments'=>$this->input->post('comments'),
'results'=>$this->input->post('results'),
'selection_process'=>$this->input->post('selection_process')
);
if($data['selection_process']==1)
{
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://md-in-42.webhostbox.net',
'smtp_port' => 465,
'smtp_user' => '[email protected]',
'smtp_pass' => 'test3'
);
$this->load->library('email',$config);
$this->email->set_mailtype("html");
$this->email->from('[email protected]', 'bharathi');
$list=array('[email protected]','[email protected]');
$this->email->to($list);
$this->email->subject('YOU ARE SELECTED');
$link = 'Click on this link - <a href="http://localhost/job_portal/index.php/Login/signin">Click Here</a>';
$this->email->message($link);
$this->email->send();
}
else
{
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://md-in-42.webhostbox.net',
'smtp_port' => 465,
'smtp_user' => '[email protected]',
'smtp_pass' => 'test3'
);
$this->load->library('email',$config);
$this->email->set_mailtype("html");
$this->email->from('[email protected]', 'bharathi');
$list=array('[email protected]','[email protected]','[email protected]');
$this->email->to($list);
$this->email->subject('YOU ARE NOT SELECTED');
$link = 'Click on this link - <a href="http://localhost/job_portal/index.php/Login/signin">Click Here</a>';
$this->email->message($link);
$this->email->send();
}
$this->SelectionModel->add_selection_details($data);
$this->load->view('selection/selection_details',$data);
}
?>
请帮我怎么做..谢谢..
这是解决方案。.像这样更改您的控制器和模型代码。
控制器:
public function add_selection()
{
$data["msg"]="";
$this->load->model('SelectionModel');
$data['rolename']=$this->SelectionModel->getrolename();
$data['candidate']=$this->SelectionModel->getcandidates();
$data['usertype']=$this->SelectionModel->getusers();
$data['companyname']=$this->SelectionModel->getcompanyname();
if($ this-> input-> post()){
$this->SelectionModel->add_selection_details($this->input->post());
$all_users = $this->input->post('user_id');
print_r($all_users);
foreach($all_users as $key)
{
$get_email = $this->SelectionModel->get_user_email_by_id($key);
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://md-in-42.webhostbox.net',
'smtp_port' => 465,
'smtp_user' => '[email protected]',
'smtp_pass' => 'test3'
);
$this->load->library('email',$config);
$this->email->set_mailtype("html");
$this->email->from('[email protected]', 'bharathi');
$this->email->to($get_email);
$this->email->cc('[email protected]');
$this->email->bcc('[email protected]');
$this->email->subject('this is our candidate details 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('selection / selection_details',$ data); }
模型:
function add_selection_details($post='')
{
$data=array(
'selection_id'=>$this->input->post('selection_id'),
'comments'=>$this->input->post('comments'),
'results'=>$this->input->post('results'),
'role_id'=>$this->input->post('role_id'),
'candidate_id'=>$this->input->post('candidate_id'),
'company_id'=>$this->input->post('company_id'),
'user_id'=> implode(',',$this->input->post('user_id'))
// 'selection_process'=>$this->input->post('selection_process')
);
$this->db->insert('selection', $data);
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句