Jump to content

undefined index: message_from_previous_page


jeff5656

Recommended Posts

I get the undefined index error for this code:

 

if ($_SESSION['message_from_previous_page']){
echo $_SESSION['message_from_previous_page']; 
$_SESSION['message_from_previous_page'] ='';
}

 

The code does not die, but I want to address it.  How do I deal with this if sometime $_SESSION['message_from_previous_page'] is undefined (like when a user first logs on and this variable is not yet assigned.  I thought that putting it inside the if statement would work to "hide" the undefined variable but nope!

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.