• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[PHP] Undifined index/variable

HappyFeet

New Member
Joined
Nov 8, 2012
Messages
244
Reaction score
3
Location
Netherlands
got this error. someone can help me?

PHP Notice: Undefined variable: acc_logged in \account.php on line 404
PHP Notice: Undefined variable: created in \account.php on line 411

line 404: if ($acc_logged!= "")
line 411: if ($created != true)

when I change it to:
if ($_POST['account'] != "")
if ($_POST['created'] != true)

I get this error:
PHP Notice: Undefined index: account in \account.php on line 404

PHP Notice: Undefined index: created in \account.php on line 411
 
@ricotje1

if the variables are not declared use this:

Code:
if(isset($_POST['acc_logged'])) {
  ...
}

if they are:

Code:
if(isset($acc_logged)) {
  ...
}

if you want to check (not) case:
Code:
 if(!isset($_POST['acc_logged'])) {  ... }
or
Code:
 if(!isset($acc_logged)) { ... }
 

Similar threads

Back
Top