php - how to show insert update messages on same page in codeigniter -


when inserting or updating data in codeigniter want show message whether data inserted or updated message showing in controller want show on view page. , don't want redirect during update , insertion.

here update time code in controller i.e. showing message.

if($result)     {             $this->load->view('includes/header');             $this->load->view('includes/menu');             echo "<div class='success'>";             echo "successfully updated";             echo "</div>";              redirect(current_url());       }     else      {              $this->load->view('includes/header');             $this->load->view('includes/menu');             echo "<div class='error'>";             echo "somthins missing";             echo "</div>";       }   

i want know using redirect(current_url()); correct or without using can generate message controller view.

you can send data view like

$data['msg']='message inserted successfully';   $this->load->view('includes/header',$data); //send data 

then retrieve in view directly

echo "<div class='success'> $msg   </div>"; 

Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -