Jump to content

IF statement help.


herghost

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.