Quick Table of Contents
[Edit] Notice: Undefined Index
This notice means that a global or superglobal variable has not been set in your PHP before you attempted to script with it. Meaning you have to see first if that variable is set or ready for use in the script. If you are building a form all you have to do is see that one of the form's $_POST variables isset() before gathering the variables up into local PHP variables. Simply trying to place a $_POST[''] type variable in your script without seeing if it is set first, will render this Notice in many PHP environments. Some environments will not render this error depending on the PHP configuration on the server. How can i fix itBefore trying to access certain variables or globals make sure that one in the group is set first... then script your heart out using those variables. Use the isset() PHP function.if (isset($_POST["submit"])) { $button = $_POST["submit"]; $uname = $_POST["name"]; $uemail = $_POST["email"]; } [Edit] Notice: Undefined variable
This notice means that a variable that is in place for output or manipulation in your script has not been initialized or defined prior to using it. How can i fix itAt the top of your PHP script you can simply initialize the variable names with an empty value, or wherever it makes sense to define them. Most times on top is best. After it is initialized the notice will go away and you can use those variables for output or anything else.$var1 = ""; // initialize blank or place any default value upon creation $var2 = ""; // initialize blank or place any default value upon creation |
This Page is Under Construction! - If You Want To Help Please Send your CV - Advanced Web Core (BETA)
© Advanced Web Core. All rights reserved