如何从codeigniter的控制器中的数组中检索单个值

时间:2013-09-12 06:12:30

标签: php codeigniter

这是我的控制器代码,用于插入记录。

function insert()
{
    $first_name=$this->input->post('first_name');
    $last_name=$this->input->post('last_name');
    $father_name=$this->input->post('father_name');
    $doj=$this->input->post('doj');
    $course=$this->input->post('course_name');
    $fee_pay=$this->input->post('fee_pay');
    $photo=$this->input->post('photo');


    $input=array(
    'first_name'=>$first_name,
    'last_name'=>$last_name,
    'father_name'=>$father_name,
    'date_of_join'=>$doj,
    'course'=>$course
    );

    if($first_name!="" && $last_name!="" && $father_name!="" && $doj!="" && $course!="")
    {
        if(!$this->payment_model->insert($input))
        {
            //this is code to get data from fee database.
            $fee['t']=$this->payment_model->select_fee($course);
            //this code to get data from regestration database.         
            $id_data['data']=array($this->payment_model->select_id($first_name, $last_name, $father_name, $doj, $course));

            echo "Student Detail Inserted";



            $this->load->view('payment_step2');
        }
        else
        {
            echo "there is some problem in insertion";
        }
    }
    else
    {
        echo "please enter all the option to insert detail of student";
    }

}

0 个答案:

没有答案