herghost Posted November 1, 2010 Share Posted November 1, 2010 Hi all, I have the below which triggers an alert box when the user is redirected to the index page. <?php if(!empty($_SESSION['reg'])) { echo '<div id="alert">' . $_SESSION['reg'] . '</div>'; unset($_SESSION['reg']); } if(!empty($_SESSION['fail'])) { echo '<div id="alertr">' . $_SESSION['fail'] . '</div>'; unset($_SESSION['fail']); } if(!empty($_SESSION['logged'])) { echo '<div id="alertr">' . $_SESSION['logged'] . '</div>'; unset($_SESSION['logged']); } if(!empty($_SESSION['failedlog'])) { echo '<div id="alertr">' . $_SESSION['failedlog'] . '</div>'; unset($_SESSION['failedlog']); }?> It only works when session ['reg'] contains a value. I guess I can not use if statements in this way but not quite sure what I should be using? Many Thanks Quote Link to comment Share on other sites More sharing options...
sastro Posted November 1, 2010 Share Posted November 1, 2010 Need more explain about the result should be Quote Link to comment Share on other sites More sharing options...
herghost Posted November 1, 2010 Author Share Posted November 1, 2010 They just display a js popup. This works fine for the 1st if statement but not for the rest, the value of the session is displayed in the popup Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.