Welcome Guest, Not a member yet? Register   Sign In
Sessions not working on CI 3
#1

Hi;

I create session manually and it works fine locally but not when I upload it to server. Can anyone see what I am doing wrong?

'Thanks

Creating session in controller
PHP Code:
if($_POST)
 {
 if((
strlen($_POST['comment'])>2) && ($_POST['secret']==5))
 {
 
$data = array(
 
  'comment' => $_POST['comment'],
 
  'page_id' => $this->data['id'],
 
  'email' => $_POST['email'],
 
  'date_added' => date('Y-m-d')
 );
 
$this->db->insert('breakup_comments'$data);
 
$_SESSION['comment_added'] = '<strong class = "green">Your comment has been added successfully! It will appear in a couple hours :)</strong><br /><br />';
 
redirect($this->data['return_path'], 'refresh');
 }



Viewing..well trying to
PHP Code:
if(isset($_SESSION['comment_added']))
 
             {
 
               if(strlen($_SESSION['comment_added'])>3)
 
                 {
 
                   echo $_SESSION['comment_added'];
 
                   $_SESSION['comment_added'] = "";
 
                  
              

Reply


Messages In This Thread
Sessions not working on CI 3 - by behnampmdg3 - 04-29-2015, 09:01 PM
RE: Sessions not working on CI 3 - by Avenirer - 04-30-2015, 07:15 AM



Theme © iAndrew 2016 - Forum software by © MyBB