PHP is one of the favorite scripting language tools amongst Webmasters. However at times a user may come across an "undefined index" error message. This error is mainly due to improper variable settings. While recovering variables from a user-filled form, an error may occur. Usually in PHP $_POST and $_GET commands are used to retrieve values that are indicated in a form. While using these functions you may come across this Notice: Undefined index message. To get rid of this error make sure that the table field is set to isset () function, which determines whether a certain value has already been declared by PHP. This error message can be postponed before the configuration of the server. You can change the type of error reported using error_reporting function.
Notice: Undefined index
When trying to recover variables from your forms, if you use the $ _POST
or $ _GET
variables to recover your forms or otherwise, you may come across this error:
Notice: Undefined index in 'file path executing php' on line 'current line'
To avoid this error, test whether the table fields was set with the function is set ().
Example for a variable $ _POST [ 'trick']:
/ / Before you use $ _POST [ 'trick']
if (isset ($ _POST [ 'trick']))
/ / Instructions if $ _POST [ 'trick'] exists
This type of error is postponed prior to the configuration of the server.
It is not reported by default because it is not important, depending on the constant <gras>E_NOTICE
You can change the types of errors reported using the error_reporting
In the same category
Published by deri58
- Latest update by Virginia Parsons