Welcome Guest, Not a member yet? Register   Sign In
Form With Multiple Fields [Array] Query
#4

Hi,

It's working to some extent, but i dont think i have the correct ID for each individual form field im retreiving from the db.

Is there a way I can pass the ID from the view back into my controller?

e.g 'name'=>'keyword_meta_title[][ID]?

Then in my controller use this ID inside my update statement?

See my code below, and a comment on the area which i beleive is the issue.

PHP Code:
if($this->form_validation->run() === TRUE){ 
 
 
$keyword_meta_title $this->input->post('keyword_meta_title');
 
$keyword_meta_description $this->input->post('keyword_meta_description');
 
$keyword_meta_keywords $this->input->post('keyword_meta_description');
 
$keyword_slug $this->input->post('keyword_meta_description');
 
$keyword_heading $this->input->post('keyword_meta_description');
 
$keyword_content $this->input->post('keyword_meta_description');
 
 
$max count($keyword_meta_title);

 for (
$count=0$count $max$count++) {
 
$data = array(
 
'keyword_meta_title' => $keyword_meta_title[$count],
 
   'keyword_meta_description' => $keyword_meta_description[$count],
 
'keyword_meta_keywords' => $keyword_meta_keywords[$count],
 
'keyword_slug' => $keyword_slug[$count],
 
'keyword_heading' => $keyword_heading[$count],
 
'keyword_content' => $keyword_content[$count]
 ); 
 
                               // this id i think is incorrect
 
                              // i think i need to pull the id from the input field if possible?
 
$this->website_model->update_keywords($id$data);
 }
 
   $this->alert("Website updated successfully""success");
 } 
Reply


Messages In This Thread
RE: Form With Multiple Fields [Array] Query - by MoFish - 07-11-2016, 01:24 PM



Theme © iAndrew 2016 - Forum software by © MyBB