Search code examples
phpsuperglobals

PHP Array key strings without quotation marks


I am moving the files to the server and is using variables like $_GET[mode] without ''(single quotes) in 'mode'. It works perfectly locally but on the server i am getting notices.. How can i overcome this?here is my phpinfo file phpinfo Is there any way we can have same behavior to work on server as well?


Solution

  • How can you overcome the E_NOTICEs that complain that you forgot quotes around your strings?

    Add quotes around your strings.

    $_GET['mode']
    

    Also it sounds like the error_reporting level on your local server is not sufficient. It should be high, so that you see these sorts of mistakes as you develop your website/application.

    On your production server it may be set lower.