Nightchild
05-09-2008, 02:27 AM
I'm making the switch to PHP5 on my web host.
The web host that I am using has it's PHP5 configured to E_ALL. In the footer of my page I attempt to display $_SESSION['user_name']. When the user is not logged in - therefore no $_SESSION variables - I now get errors displayed.
"Undefined index: user_name in ..."
Without simply suppressing the error reporting, how should I correct this? I guess that I could always use IF's to check if the session variable has a value or I could pull the session variables into local variables. BUT is there another way to do this? What is considered the "correct" method to handle undefined session variables?
Thanks
The web host that I am using has it's PHP5 configured to E_ALL. In the footer of my page I attempt to display $_SESSION['user_name']. When the user is not logged in - therefore no $_SESSION variables - I now get errors displayed.
"Undefined index: user_name in ..."
Without simply suppressing the error reporting, how should I correct this? I guess that I could always use IF's to check if the session variable has a value or I could pull the session variables into local variables. BUT is there another way to do this? What is considered the "correct" method to handle undefined session variables?
Thanks