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
2
votes
1 answer

PHP Undefined index after config file into array

This is my config load code: $WConfig; $lines = file($ToRootDirectory . 'config.txt', FILE_SKIP_EMPTY_LINES); foreach ($lines as $line_num => $line) { $line = trim($line); if (!(substr($line, 0, 1) == '#')){ …
xlofev276
  • 36
  • 3
1
vote
3 answers

undefined index : Name in ~\order.php on line 12

i create project for customer. when i run the project in wamp server i can view project correctly , but when costumer running project in our wamp server face this error , undefined index : Name in ~\order.php on line 12 undefined index : Name in…
aya
  • 1,597
  • 4
  • 29
  • 59
1
vote
2 answers

Getting 'undefined index' error while trying to use $_FILE in PHP

I can easily upload the files into the database But when i want to edit the files,I am getting Undefined error. Here is the code: product_update.php This is where i am able to modify all the existing information of particular records in the…
Miff Rose
  • 37
  • 2
  • 7
1
vote
1 answer

Laravel 8: Undefined index

I'm working on a questionnaire project and I ran into an error saying: Undefined index: exams This happened when I was trying to store responses to my database. Here is my controller code: public function store(Math $math) { $data…
Iam-kelvin
  • 25
  • 3
1
vote
1 answer

How to address safely complex data structures passed on a laravel blade?

In Laravel you might pass quite complex data structures to a blade. On Those data structures you might assume that have keys and different levels on writing a blade. What is the bst practice to handle possible undefined index on the blade code? Is…
koalaok
  • 5,075
  • 11
  • 47
  • 91
1
vote
0 answers

Problem with Drag and Drop file upload using PHP server script

I'm trying to upload files using PHP script on the server as the upload handler. It works just fine with a traditional web form like this:
Select image to upload: …
1
vote
0 answers

Can't figure out why I'm getting "undefined index" for one section of code but not another

I have several "multiple" select boxes I'm pulling data from. The first two work fine, but when I get to the third, either isset($_POST('name')) returns false, or, if I take it out, I get an "undefined index" notice. I've tried copypasting the code…
hamahara
  • 21
  • 2
1
vote
1 answer

PHP Getting "undefined offset" when Trying to Access Elements in Multidimensional Arrays

I have the following array: 1, 'name' => 'Artist 01', 'section' => array( 'engagement', 'wedding' ), 'featured_img' => array( 'engagement' => 0, 'wedding' => 2 ), …
Marisa
  • 151
  • 1
  • 3
1
vote
1 answer

How can i convert json data into php variables?

I have a json file which I want to get the data from and use it as php variables inside of a loop. I keep getting Undefined index erros and it just does not work... This is my code: $file = file_get_contents("csv/products.json",'r'); …
1
vote
1 answer

Undefined index in array but it is there

I have an array called $csv. The header columns are contained within $csv[0]. I have a loop that goes in and overwrites some data in the $csv array starting at index 1. For some reason it is no longer getting any value when I try to output…
Danny Beckett
  • 20,529
  • 24
  • 107
  • 134
1
vote
0 answers

Undefined index:Type with $GLOBAL variable

I set a Super global variable $GLOBALS['Type']="JobSeeker" but in another file that variable is not accessed While Running Program am getting Undefined Index:Type. Page1.php: $con = mysqli_connect("localhost","root","","job1"); // Specify the query…
shiva7890
  • 41
  • 1
  • 7
1
vote
2 answers

How to check weather the $_GET is being received or not? (PHP)

I have a form on the page. It has too many things like checkboxes and text fields and dropdowns. But when I don't select one of the checkboxes, the PHP page where i catch the form shows me an error. Example: The HTML Code: Checkbox 1
Arjun Bajaj
  • 1,932
  • 7
  • 24
  • 41
1
vote
1 answer

why there is undefined index notice though variable is defined?

I am getting an undefined index notice in my php code though I defined a variable and submitting it with POST method. Here's the code:
1
vote
1 answer

PHP PDO Undefined index error Using Fileuploader class

Hi I'm working on a project where I want to use this file-uploader class, but i keep getting this error : **Notice:** Undefined index: filename in C:\xampp\htdocs\proceskontrol\partials\newtype.php on line 8 Any idea how it can be fixed? I am 99,9%…
user10511312
1
vote
2 answers

(PHP, AJAX) Simple counter. Figured the problem, no solution

Apologies for having to ask. In short I'm making a simple imageboard with a "like" button for each image. The number of clicks (likes) stores in 'counter.txt' file in the following format: click-001||15 click-002||7 click-003||10 Clicking the…
1 2
3
18 19