i have php file include this line:
$uid = $_GET['uid'];
but if I open this page Directly i have this error
Notice: Undefined variable: uid in D:\xampp\htdocs\ask\index.php on line 6
sometimes i need direct access and sometimes not
i have php file include this line:
$uid = $_GET['uid'];
but if I open this page Directly i have this error
Notice: Undefined variable: uid in D:\xampp\htdocs\ask\index.php on line 6
sometimes i need direct access and sometimes not
$_GET takes the values from the URL parameter. And you are opening it directly that's why it is not getting uid index from URL parameter and giving this error.
To omit this error you need to do this:
$uid = (isset($_REQUEST['uid'])) ? $_REQUEST['uid'] : '';
Use the $_REQUEST because it takes the values from get and post both commonly, this will be good practice to you.
If you are hitting the URL directly then you need to give the parameter like this:
your_url?uid=xxx //any value as you want can give