If you are maintaining old code, you probably cannot aim for "the best possible code ever"... That's one case when, in my opinion, you could lower the error_reporting
level.
These "undefined index" should only be Notices ; so, you could set the error_reporting
level to exclude notices.
One solution is with the error_reporting function, like this :
// Report all errors except E_NOTICE
error_reporting(E_ALL ^ E_NOTICE);
The good thing with this solution is you can set it to exclude notices only when it's necessary (say, for instance, if there is only one or two files with that kind of code)
One other solution would be to set this in php.ini (might not be such a good idea if you are working on several applications, though, as it could mask useful notices ) ; see error_reporting in php.ini.
But I insist : this is acceptable only because you are maintaining an old application -- you should not do that when developping new code !