Re: Re: undefined $_GET index.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 24, 2013 at 6:55 PM, Aziz Saleh <azizsaleh@xxxxxxxxx> wrote:

> On Tue, Dec 24, 2013 at 9:51 PM, atar <atar.yosef@xxxxxxxxx> wrote:
>
> > 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.php
> >
> >
> In 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
> }
>

Oops, Aziz scooped me on this one!

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux