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 Link to comment https://forums.phpfreaks.com/topic/217489-if-statement-help/ 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 Link to comment https://forums.phpfreaks.com/topic/217489-if-statement-help/#findComment-1129189 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 Link to comment https://forums.phpfreaks.com/topic/217489-if-statement-help/#findComment-1129191 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.