[eluser]dinisptc[/eluser]
hi, i have a view with several demands and the problem is that only saves the last one from the foreach
Code:
<?php echo form_open("demand/edit_demand_meet/{$this->uri->segment(3)}/{$this->uri->segment(4)}"); ?>
<?php foreach($demands as $dem)
{?>
<div id="demandUID" class="prefBloc">
<input type="hidden" name="demanduid" value="<?php echo $dem['uid']; ?>" />
<!--<h3>-->
<p>
<h3> NÂș <?php echo $dem['number']; ?> </h3>
</p>
<p>
<h3>
<input type="text" name="demandname" id="demandname" placeholder="<?php echo $ts395 //demand ?>" value="<?php echo $dem['name']; ?>" />
</h3>
</p>
<!--</h3>-->
<p><input type="text" name="description" id="description" placeholder="<?php echo $ts396 //description ?>" value="<?php echo $dem['description']; ?>" /><?php //echo $dem['description']; ?> </p>
</div>
<?php } //demands?>
<input type="submit" class="submit" value="<?php echo $ts380 //save ?>" />
here is the controller
Code:
function edit_demand_meet()
{
if (!$this->ion_auth->logged_in())
{
//redirect them to the login page
redirect('user/login', 'refresh');
}
elseif (!$this->ion_auth->is_admin())
{
$group = 'architect';
$groupmembers = 'members';
if (($this->ion_auth->in_group($group))or($this->ion_auth->in_group($groupmembers)))
{
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
//$this->load->view('formsuccess');
// get the user object
$data->the_user = $this->ion_auth->user()->row();
// put the user object in class wide property--->---->-----
$this->the_user = $data->the_user;
// load $the_user in all displayed views automatically
$this->load->vars($data);
//set the flash data error message if there is one
$this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
$DContent['page_details'] = array('page_title' => 'Index of freejoBoard');
$Dmeta = array('meta_title'=>'Welcome to Onplans','meta_descricao'=>'onplans');
$Dheader = array();
$Dsidebar = array();
$Dfooter = array();
//$dueDate =$this->input->post('dueDate');
$demand_uuid =$this->input->post('demanduid');
$demandname =$this->input->post('demandname');
$description =$this->input->post('description');
print_r($demand_uuid);
$task_uuid =$this->input->post('taskuid');
$taskname =$this->input->post('taskname');
$this->task_model->update_task_meet($task_uuid,$taskname);
$this->demand_model->update_demand_meet($demand_uuid,$demandname,$description);
$this->data['message']='saved successfuly';
$projectUID=$this->uri->segment(3,0);
$meetingUID=$this->uri->segment(4,0);
//$Ddata['timeline']=$this->timeline_model->listar_timeline_onlyreports(0,0,$projectuid);
$this->data['meetproj']=$this->timeline_model->listar_project_meeting($projectUID,$meetingUID);
$this->data['meetpresences']=$this->timeline_model->listar_presences_contractors($meetingUID);
//demands
$this->data['demands']=$this->timeline_model->listar_timeline_demands($projectUID);
//preenche as variaveis
$this->template->write_view('meta', 'html/meta', $Dmeta, true);
$this->template->write_view('head', 'html/head_index');
$this->template->write_view('header', 'html/header', $Dheader, true);
$this->template->write_view('content', 'onplans/list_my_project_meeting', $this->data, true);
//$this->template->write_view('content', 'onplans/success_edit_demand',$this->data,true);
$this->template->write_view('sidebar', 'html/sidebar_user');
$this->template->write_view('footer', 'html/footer');
$this->template->render();
}
}
else
{
redirect('user/login', 'refresh');
}
}
I have to find a way to edit each demand separately , what its happening is only i can save the last one from the loop
thanks