hallow guys. hope you doing good
so my problem is I want to throw toaster message telling users status of last operation like:
Code:
$this->session->set_flashdata('error_message',get_phrase('invalid_login_credentials'));
then i redirect to home page and catch the messages :
Code:
redirect(site_url('home'), 'refresh');
Code:
<?php if ($this->session->flashdata('error_message') != ""):?>
<script type="text/javascript">
$(document).ready(function () {
toastr.error('<?php echo $this->session->flashdata("error_message");?>');
});
</script>
<?php endif;?>
every thing work fine in xampp localhost. but in live server sometimes the message show sometimes not. after testing and debugging i found that
$this->session->flashdata("error_message") is empty when message not show. and i try to use userdata rather flashdata i found that sometimes in first redirect message not shown ( same thing as flashdata ) but in every other refresh message shown in userdata.
is that because session blocking or CodeIgniter problem or maybe slow writing mechanism ?
here my session configuration
Code:
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 259200;
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 0;
$config['sess_regenerate_destroy'] = FALSE;
pls help me in this.
thanks