I have too separate PHP files:
- add-new-module.php
- _add-new-module.php
I' am using the function require_once _add-new-module.php
in the add-new-module.php
at the very top of the page. I have initialized the variable $msg
into _add-new-module.php
for some reason its still showing up error message as:
Notice: Undefined variable: msg in xxxxxxxxxxx/add-new-module.php on line 2
When echoing the variable $msg
in _add-new-module.php
it WORKS but when I try to echo the variable $msg
in add-new-module.php
it gives me above error. When I used islet
on the variable $msg
well it hides error message but doesn't show anything on the page.
I have also replaced include with include_once
, require_once
and require
. Still no luck. I have also used global $msg
hides the error message but doesn't seems to display the result.