Hello,
I Am New To Codeigniter PHP !
i want to submit different section of my form and want to update it as well!
basically i have 3 different form in my one main page with one submit button,but i have taken only one <form>
tag and for all the forms.
so here is my controller
<?php
public function Resume()
{
if($this->input->post('Skills'))
{
foreach($this->input->post('Skills') as $key =>$value )
{
$this->form_validation->set_rules('resume_id['.$key.']', 'Key ID '. ($key+1), 'required');
$this->form_validation->set_rules('employer_name['.$key.']', 'Employer Name '. ($key+1), 'valid_email');
}
if ($this->form_validation->run() == true){
$Resume = $this->input->post();
$ResumeInsert=array();
$ResumeUpdate=array();
foreach($this->input->post('Person_id') as $key =>$value )
{
$ResumeInsert[$key]['Person_id'] = $Resume['Person_id'][$key];
$ResumeInsert[$key]['email_contact'] = $Resume['email_contact'][$key];
$ResumeInsert[$key]['Contact_Phone'] = $Resume['Contact_Phone'][$key];
$ResumeInsert[$key]['communication'] = $Resume['communication'][$key];
$ResumeInsert[$key]['creativity'] = $Resume['creativity'][$key];
}
}
foreach($this->input->post('emp_id') as $key =>$value )
{
$ResumeInsert[$key]['resume_keyid'] = $Resume['emp_id'][$key];
$ResumeInsert[$key]['employer_name'] = $Resume['employer_name'][$key];
$ResumeInsert[$key]['start_Date'] = $Resume['start_Date'][$key];
$ResumeInsert[$key]['end_date'] = $Resume['end_date'][$key];
}
foreach($this->input->post('resume_id1') as $key =>$value ){
$ResumeInsert[$key]['edu_id'] = $Resume['resume_id1'][$key];
$ResumeInsert[$key]['year_gain'] = $Resume['year_gain'][$key];
$ResumeInsert[$key]['qualification_name'] = $Resume['qualification_name'][$key];
$ResumeInsert[$key]['institution_name'] = $Resume['institution_name'][$key];
}
if(isset($Resume['id'][$key]))
{
$Key_Resume__ExistIDs[]=$Resume['id'][$key];
$ResumeUpdate[$key]=$ResumeInsert[$key];
$ResumeUpdate[$key]['resume_id']=$Resume['id'][$key];
unset($ResumeInsert[$key]);
}
else{
$ResumeInsert[$key]['resume_id'] = $GetLastID;
$GetLastID++;
}
$idsToDelete='';
if(empty($ResumeInsert) && empty($ResumeUpdate)){
$idsToDelete=array_diff($Key_Resume_IDs,$Key_Resume__ExistIDs);
}
$status=$this->Resume_model->ProcessData($idsToDelete,$ResumeUpdate,$user_id,$ResumeInsert,$imgInsert,$imgUpdate);
redirect('Resume','refresh');
}
}
In Above Code $this->input->post(“Skills”) is a submit button,and every Foreach loop is different section of my form
so what is my issue is,if i submit all the sections togather then its works perfect ! but if i am going to submit one particular section then that particular section can update but rest section bacome NULL
what i need to do is,i can update/insert any single section but previous section should not be null
can’t understand where is the mistake?please any help?