Re: Re: undefined $_GET index.
| From: | atar | Date: | Wed, 25 Dec 2013 09:00:43 +0000 |
| Subject: | Re: Re: undefined $_GET index. | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-322621@lists.php.net to get a copy of this message | ||
Aziz Saleh wrote:
On Tue, Dec 24, 2013 at 9:51 PM, atar <atar.yosef@gmail.com> wrote:But why when I use the 'test.php' script as a router, the $_GET['r'] index isn't get defined? that's what wonder me.At Christoph Michael Becker: Thanks you for your advice! it solved the problem. But I didn't succeed to understand HOW the action of dropping the script argument from the command line was worked? why does PHP complain about the undefined $_GET['r'] variable when the test.php script is used as router? Regards, atar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpIn PHP, when you try to access a variable and that variable doesn't exist, it throws a notice. In your case the router.php was executed with no r GET param, causing the notice. You can duplicate that by accessing: http://127.0.0.1:8000/test.php (notice the r GET param is not set). As a good practice you should always use isset() before trying to access a param that might not be set: if (isset($_GET['r'])) { // use it }