php - Giving css to session flash data in codeigniter -
is there way set css codeigniter session flashdata. want give success or error message when user redirected controller view after success or error. suppose
in controller
$this->session->set_flashdata("msg", "<div class='alert alert-success'> data inserted.</div>"); redirect("contoller/method"); in view
echo $this->session->flashdata("msg"); in case success alert of bootstrap. need make div in set_flashdata , lengthy process. want know, if possible send third parameter flashdata thats know if error flashdata or success flash , accordingly show bootstrap success or error alert. greatfull.
if understand request well, should dedicate value variable regarding insert process. should set flashdata. like:
$insert = $this->some_model->insert($data); if ($insert != false) {//or controll make in model method return $msg = "<div class='alert alert-success'> data inserted.</div>"; } else { $msg = "<div class='alert alert-danger'> error while inserting. please try again.</div>"; } $this->session->set_flashdata("msg", $msg);
Comments
Post a Comment