Need FLASH DATA NEED HELP |
[eluser]razerone[/eluser]
HI I am trying to have s div show up on my form for flash data that will only show up when message sent successfully the div i am trying to display at bottom of form is <div class="alert alert-success">Flash Data</div> I had it going but when did it showed up on the normal contact page as well and the confirmation section redirect. I have read user guide but can't get it right. Here is my php Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
[eluser]CroNiX[/eluser]
You didn't post the view, which is where it would be displayed. What is this doing? I don't see you doing anything with $success after you create it (you don't pass it anywhere or anything), but you try to read the session data here before you actually create the session data. Code: $success['flash'] = $this->session->flashdata('success'); All you really need here is to set the session data in the controller: Code: $this->session->set_flashdata('success', 'Message Has Been Submitted Successfully'); And then display it if it exists in the view: Code: $message = $this->session->flashdata('success');
[eluser]razerone[/eluser]
[quote author="CroNiX" date="1383411501"]You didn't post the view, which is where it would be displayed. What is this doing? I don't see you doing anything with $success after you create it (you don't pass it anywhere or anything), but you try to read the session data here before you actually create the session data. Code: $success['flash'] = $this->session->flashdata('success'); All you really need here is to set the session data in the controller: Code: $this->session->set_flashdata('success', 'Message Has Been Submitted Successfully'); And then display it if it exists in the view: Code: $message = $this->session->flashdata('success'); Sorry for late reply I did work that out last night. Controller Code: $data_success['message_success'] = '<div class="alert alert-success">Your Message Has Been Recived Will Get Back To You In 24/48 Hours</div>'; View Code: <div class="row"> But people say. it is best to make a data variable for it would you know what I would need to do? Also on another topic. when my validation kicks in the content that was entered correct goes ways and have to re enter it I only want to be able to re enter the validation errors if any comes up. |
Welcome Guest, Not a member yet? Register Sign In |