PHP Notice: Undefined variable fix

This warning is generated when a variable is not defined in php.
Using the following example i`l generate this notice and i will explain how to avoid this.
Assuming this to be a file named : testfile.php

Accessing testfile.php from browser will give the following notice :

Now let’s fix it :

Isset checks if a variable is defined or not. If is defined will execute it , if not will ignore it but will not generate any notice.

One Response to PHP Notice: Undefined variable fix

  1. RYan says:

    Simple answer thank you

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">