PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I hope anyone could help me, I have a problem with some code using sessions, in the first page I initialize the variable with some value, and in the third page, I need to do a validation with such variable, but It appears two notice, wich I have never heard them before, like:
NOTICE: Undefined Index: variable in D:/mydocuments on line 74
Oh. Ok then. I really ought to read threads before commenting I guess.
You're going to have to use print_r($_SESSION) a lot to find out where you're trying to change a session variable before you've set it. I looked at the code in a PHP editor, and couldn't quite work out how you're getting an error on line 74 in page3 .. it's only 52 lines long.
oh oooh, sorry, it seems like to be 52 cause I edited a quit bit, but it sure is the line where the session variables are, that is the activa and perfil variables, it seems like a case for the twilight zone.
if (isset($_SESSION['activa']) {
if($_SESSION['activa']!=1){
echo $advertencia="SESION NO ACTIVA", "<br><br>";
redir("pag_principal.php");
}
}
I think the problem is that your PHP error level is set so low that you're getting NOTICEs echo'd out, and that's mucking up the output. Technically, checking an array index that isn't set really isn't a problem, so you should be able to safely ignore the problem. But as the error level is set to tell you about it you're going to need to code around it.
Also, always wrap any code you post here in [syntax=php][/syntax] tags. That makes the code colourized and maintains indentation - much, much, much easier to read.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.