Jump to content

[SOLVED] I am using $_SESSION['flash']['warning'] to display error msg and need some help


kee2ka4

Recommended Posts

Hey peeps,

 

I have a question as why Internet explorer never displays my error messages the frist time I run my code and always displays it the second time. I am using $_SESSION['flash']['warning'] to displays messages.

 

Here is the breakdown of my code. I am using the function below to display error messages:

function flash_warning($msg) 
{
    if(!$msg) { return false; }
    $_SESSION['flash']['warning'] = $msg;
    return true;
}

In my controller file I have the following code that simply decides if the condition in false then display the message.

if(!formSent($params))
{flash_warning("Sorry your message cannot be sent");}

In the view file, I display the error mesage(if there is any) using a  simple if statement:

<?php if($_SESSION['flash']['warning']) { ?>
<span class="helpMsg"><?php echo $_SESSION['flash']['warning']; ?></span>

 

 

The above code works fine the with Firefox but with Internet Explorer it never displays the error message the frist time and always displays it the second time. Can anyone please guide me why this happens?

 

Thanks,

Zub

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.