我试图在学校建立一个招生系统,我需要帮助
不要复制带有middlename的电子邮件和全名,但如果名称和姓氏相同,则可以添加,但使用中间名将不会继续添加学生。我更新学生时仍然处理相同的过程
function student($param1 = '', $param2 = '', $param3 = '')
{
if ($this->session->userdata('admin_login') != 1)
redirect('login', 'refresh');
if ($param1 == 'create') {
$data['name'] = $this->input->post('name');
$data['mname'] = $this->input->post('mname');
$data['lastname'] = $this->input->post('lastname');
$data['birthday'] = $this->input->post('birthday');
$data['sex'] = $this->input->post('sex');
$data['address'] = $this->input->post('address');
$data['phone'] = $this->input->post('phone');
$data['email'] = $this->input->post('email');
$data['password'] = md5($this->input->post('password'));
$data['father_name'] = $this->input->post('father_name');
$data['mother_name'] = $this->input->post('mother_name');
$data['class_id'] = $this->input->post('class_id');
$data['roll'] = $this->input->post('roll');
$this->db->insert('student', $data);
$student_id = mysql_insert_id();
move_uploaded_file($_FILES['userfile']['tmp_name'], 'uploads/student_image/' . $student_id . '.jpg');
$this->email_model->account_opening_email('student', $data['email']); //SEND EMAIL ACCOUNT OPENING EMAIL
$this->session->set_flashdata('flash_message', get_phrase('add_student_success'));
redirect(base_url() . 'index.php?admin/student/' . $data['class_id'], 'refresh');
}
if ($param2 == 'do_update') {
$data['name'] = $this->input->post('name');
$data['mname'] = $this->input->post('mname');
$data['lastname'] = $this->input->post('lastname');
$data['birthday'] = $this->input->post('birthday');
$data['sex'] = $this->input->post('sex');
$data['address'] = $this->input->post('address');
$data['phone'] = $this->input->post('phone');
$data['email'] = $this->input->post('email');
$data['password'] = md5($this->input->post('password'));
$data['father_name'] = $this->input->post('father_name');
$data['mother_name'] = $this->input->post('mother_name');
$data['class_id'] = $this->input->post('class_id');
$data['roll'] = $this->input->post('roll');
$this->db->where('student_id', $param3);
$this->db->update('student', $data);
move_uploaded_file($_FILES['userfile']['tmp_name'], 'uploads/student_image/' . $param3 . '.jpg');
$this->crud_model->clear_cache();
$this->session->set_flashdata('flash_message', get_phrase('edit_student_success'));
redirect(base_url() . 'index.php?admin/student/' . $param1, 'refresh');
} else if ($param2 == 'edit') {
$page_data['edit_data'] = $this->db->get_where('student', array(
'student_id' => $param3
))->result_array();
} else if ($param2 == 'personal_profile') {
$page_data['personal_profile'] = true;
$page_data['current_student_id'] = $param3;
} else if ($param2 == 'academic_result') {
$page_data['academic_result'] = true;
$page_data['current_student_id'] = $param3;
}