I have 40+ of these type of lines on my page, but I’m getting an undefined index error on a odd one here and there, why are lines like below being singled out from the others.
Hi SamA74, these are only showing when I have errors on, otherwise it works fine, but just don’t understand why some are singled out whilst others the same aren’t.
I can easily resolve these below, which I have done now, but I though isset was more to use when using get or post
If there is no problem with content missing from the script output, the errors could be removed by adding an isset clause to only attempt to echo indexes that have been defined.
Just be a bit careful with these sorts of work arounds. The underlying problem is that $data does not contain everything it should. What if some other part of the code relies on the data being set?
Might consider initializing $data to at least have default values for each index. Better yet, track down why data is missing. Eventually it will bite you.
That’s what I’m getting at here.
It may be that, for example the data is getting pulled from a database where there may be fields with empty or null values, that leave empty cells in the resulting html table. That may be normal and expected. But if you are expecting to see some data for everything, there is a problem that needs further investigation.
Since we have no idea where the $data array is coming from, it’s impossible to say.