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
0
votes
2 answers

Make a general solver for the problem: undefined index in array for this program

I'm making a program in a team of programmers and it has been decided that for a specific system we'll be using an array. In the majority of the uses, all indexes in the array will be properly set still, undefined indexes can happen. Using isset()…
brunoais
  • 6,258
  • 8
  • 39
  • 59
0
votes
1 answer

cakephp: notice 8:undefined index: id error

i'm getting Undefined index: id [APP\controllers\merry_parents_controller.php, line 31]Code debug($this->data['MerryParent']); echo 'id: '.$this->data['MerryParent']['id']; MerryParentsController::login() -…
vaanipala
  • 1,261
  • 7
  • 36
  • 63
0
votes
0 answers

Variable that's being passed with an empty string and causing an undefined index issue in my logs

I know this is quite a common question but hopefully someone can provide some help for me. /** * @param $optionid * @return mixed */ public function getAttributeSwatchHashcode($optionid) { $hashcodeData =…
Singleton
  • 85
  • 2
  • 5
  • 16
0
votes
0 answers

Error after clicking submit button in CRUD application in PHP

I have made a CRUD application. Every operation works well but update operation gives error. This is index.php index.php` This is update.php update.php This is the home page: This is after clicking UPDATE button: Here is not any error, GET method…
0
votes
0 answers

Notice: Undefined index: type

I have this code in my wordpress plugin but get error Notice: Undefined index: type . how to solve this? I searched a lot, but I didn't find a solution, or maybe I didn't understand it correctly because I'm not very professional. public function…
0
votes
1 answer

PHP: Cookie in browser, but receive index undefined error

I'm setting my cookie properly in my code, for example: $expire = time()+60*60*24*30; setcookie("userid", 27, $expire); But then when I attempt to access the cookie to use it's value ($userid = $_COOKIE['userid'];), I keep receiving,…
user464180
  • 1,349
  • 2
  • 23
  • 46
0
votes
1 answer

PHP - Undefined index solving returns warining

I have a function within my PHP project which has some specific params.. $user_sequence = $user['user_sequence']; if ($cached || !$user_sequence) { return; } Notice: Undefined index: user_sequence I have fixed that with: if…
0
votes
1 answer

After successfully adding data, upon scrolling an item was removed

I am using react-table with react-window-infinite-loader and react-window for infinite scrolling. Initially the table has 20 items(data) on fetch from API. After adding a new data into my table it will successfully update(thru redux) and the data…
0
votes
1 answer

Updating table using form with AJAX

I am new to Laravel and I am trying to update a table of data using an Ajax call. The 'rent' field in the table should be the only field that can be edited, but I have been unable to get the changes to persist to the database as of yet. The error I…
0
votes
1 answer

Want to Get data from Api (json form) in blade file Laravel

This is the API that I want to get data from it "meals": [ { "idMeal": "52770", "strMeal": "Spaghetti Bolognese", "strDrinkAlternate": null, "strCategory": "Beef", "strArea":…
Timothy
  • 69
  • 7
0
votes
1 answer

Why am I throw an error for undefined index when I'm checking whether it's empty?

I've got the following error: ErrorException: Undefined array key 0 in /Users/User/Sites/Site/app/Jobs/MigrateData.php:67 This is correct in the one instance for my Job, the $this->schools is an empty array and therefore shouldn't be hitting the…
lky
  • 1,081
  • 3
  • 15
  • 31
0
votes
1 answer

Opencart Code Error

I am getting this error when my client tries to update a product in opencart 1.4.9.3: 2011-08-06 13:54:29 - PHP Notice: Undefined index: quantity in /home/adesignlink/innovativetrailers4less.com/admin/model/catalog/product.php on line…
Chad P.
  • 11
  • 4
0
votes
1 answer

How can I post data to php and print that data?

I tried requests module but I've error in my php outputs: The error is: Notice: Undefined index: firstname in D:\xampp\htdocs\myfile\receive.php on line 7 NULL code in python: ''' payload = {'firstname':'Jack'} url =…
0
votes
1 answer

Adding an array of numbers in JS gets undefined because array doesn't accept variable to pick a value

Code function Taxes(taxRate, purchases) { let total = 0; console.log(purchases); for (let i = 0; i <= purchases.length; i++) { total += purchases[i]; } console.log(total); return total * (taxRate/100 +…
Gaenox L
  • 9
  • 2
0
votes
3 answers

php foreach loop undefined property / index notice while setting value to stdclass property or array variable

In foreach loop, I am trying to add some additional property for the source array or objects. That gives me the following notice. Notice: Undefined property: stdClass::$total foreach ($this->products as $p_row) { $this->data[ $p_row->group_id…
Code Lover
  • 8,099
  • 20
  • 84
  • 154