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
Post a Comment