Questions tagged [undefined-index]

An index is undefined if it is not part of the array being accessed. Use this tag for questions regarding behaviour of undefined indexes or when you see undefined indexes where you don't expect them.

This notice appears when you try to access an undefined index of an array. These commonly appear when working with $_POST, $_GET or $_SESSION variables in PHP.

Use this tag for questions about the behaviour of undefined indexes or when you see undefined indexes where you don't expect them.

276 questions
3
votes
2 answers

why am i getting undefined indexs when i use enctype="multipart/form-data"

why am I getting undefined index's with my form is it because of the encoding type I am using, if so what can I do to fix this to properly post my variables
3
votes
2 answers

Why do I keep getting an undefined index error even though var_dump() shows the index is defined?

I'm creating an app to help keep track of the scholarship funds that kids in our youth ministry earn towards summer camp. This part of the app selects the amount they currently have from the database, saves it to a variable called $oldAmount, adds…
taseaford
  • 45
  • 9
2
votes
1 answer

register_globals off - now I get an odd undefined but it shouldn't be

What I had BEFORE was... if(DEBUGMODE) $debug_err_msgs[] = 'Some error'; // add a new error to the array ... more code here... if(DEBUGMODE)$debug_err_msgs[] = 'Some error'; // add a new error to the array which worked great EXCEPT in functions. …
PerryCS
  • 423
  • 1
  • 6
  • 20
2
votes
0 answers

php undefined index or variables don't throw any error

I came across a fat-free framework where indexes are accessed without checking if there's data present or not. few e.g. e.g.1 $sObj = new Site($db); // this returns null? $site = $sObj->getById($sessionSiteId)[0]; e.g.2 $ppObject = new…
Azima
  • 3,835
  • 15
  • 49
  • 95
2
votes
2 answers

How to pass $_POST from HTML script to PHP (getting "Undefined index" error)

Completely flummoxed after going over and over this problem for hours. Have tried a large number of approaches, without success. Intent is to send login form data to PHP and have PHP return the result of an API call. My latest approach is to have…
GCOR71
  • 21
  • 2
2
votes
0 answers

Undefined index but the index exists

I hope someone could help me with the following error. I can't find a solution. var_dump($curl->response); echo '



'; $result = json_decode(json_encode($curl->response), true); var_dump($result); echo '



'; $key =…
Armage
  • 21
  • 1
  • 6
2
votes
1 answer

How strict is undefined index?

I've turned on all error reporting to clean up some undefined indexes, just to make the app I'm making more neat. I've noticed a curious behavior: Let's say I have the following array: $a = array('test' => false, 'foo' => 'bar') If I do if…
Andrew
  • 5,095
  • 6
  • 42
  • 48
2
votes
3 answers

Php key is undefined, but there is key

I am making my own array from another one, using email field as key value. If there is more results with same email I am amking array_push to existing key. I am getting always data in my array (with email) and here is the example Input data Example…
JohnWayne
  • 651
  • 9
  • 28
2
votes
0 answers

Magically Undefined Index php

I am currently completing php a practice assessment and my browser tells me that variable "quan" on line 4 is undefined. My Programming Teacher is stumped as to what is wrong as my code seems to be correct. Here is the error message I am…
Phovon
  • 37
  • 2
2
votes
1 answer

Why am I getting undefined index when calling a php method with AJAX?

I'm trying to get some information from my albums class. I think my issue is in the syntax of my AJAX call. Let me break this down for you step by step. Here's the method: Album.php ... public function getTracks ($title) { $db =…
Jordan Carter
  • 1,276
  • 3
  • 19
  • 43
2
votes
5 answers

Why do I get undefined index

I am trying to pass a variable between two webpages via a url and using php. I am getting the undefined index error. I have tried multiple ways of doing this and spent the last several hours googling the problem and think the following code should…
Kkarinisme
  • 21
  • 3
2
votes
2 answers

Undefined Index in Post request

I have no idea why I am getting this weird error! PHP Notice: Undefined index: refId in /var/www/echo.php on line 5 I am getting Console output, but cant echo refId. Have I done anything wrong here?
Abhishek Kaushik
  • 1,121
  • 1
  • 13
  • 17
2
votes
1 answer

Wordpress custom meta fields, last input field gets "undefined index" but works after re-post

Im pretty new to php and have some issues with my code. Ive been struggling with this for a few days now, researching, editing with no luck... Please help a bro and explain how to solve my problem!! Purpose with code Adding custom meta fields to…
2
votes
2 answers

undefined index error with isset() in place?

Have I missed something here that I'm not seeing that would throw an undefined index error for this code? In testing a addition of code to functions.php where $_POST['sub'] is not being passed it throws the undefined index error below, but this same…
DMSJax
  • 1,709
  • 4
  • 22
  • 35
2
votes
1 answer

series of errors in upgrading drupal from 7.21 to 7.23

I'm getting a whole host of error messages since upgrading the core code: this message appears regularly: Notice: Undefined index: name in _ctools_list_themes() (line 567 of /home/xxx/public_html/sites/all/modules/ctools/includes/plugins.inc). and…
1
2
3
18 19