CodeIgniter Forums
May I hide Undefined index error? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: May I hide Undefined index error? (/showthread.php?tid=51622)



May I hide Undefined index error? - El Forum - 05-11-2012

[eluser]Wilianto Indrawan[/eluser]
hello guys, i need your help.

May I hide "Undefined index" error from my browser?
maybe there is a configuration to set up it.

thank you.


May I hide Undefined index error? - El Forum - 05-11-2012

[eluser]vrencianz[/eluser]
See http://ellislab.com/codeigniter/user-guide/general/errors.html

Quote:Note: By default, CodeIgniter displays all PHP errors. You might wish to change this behavior once your development is complete. You'll find the error_reporting() function located at the top of your main index.php file. Disabling error reporting will NOT prevent log files from being written if there are errors.



May I hide Undefined index error? - El Forum - 05-11-2012

[eluser]CroNiX[/eluser]
[quote author="Wilianto Indrawan" date="1336719763"]hello guys, i need your help.

May I hide "Undefined index" error from my browser?
maybe there is a configuration to set up it.

thank you.[/quote]
It would be much better to use better programming practices and see if it exists before trying to use it instead of hiding your errors or warnings. They're trying to tell you something. Fix the problems instead of hiding them.
Code:
if (isset($some_array['key']))
{
  //Do your stuff
}



May I hide Undefined index error? - El Forum - 05-11-2012

[eluser]vrencianz[/eluser]
Yep. Few guys I knew had no problem with that. ... and they insisted to work in that way Smile.

Of course, eliminating all errors/warnings/notices is the recommended practice instead of hiding them.



May I hide Undefined index error? - El Forum - 05-11-2012

[eluser]Wilianto Indrawan[/eluser]
okay, thank you guys for you advice. Smile