php error_reporting(E_ALL) problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • semanticnotion
    New Member
    • Sep 2010
    • 66

    php error_reporting(E_ALL) problem

    i put error_reporting (E_ALL) on top of my instruction page to know about the expected errors. the whole page now work fine for me and i removed
    Code:
    error_reporting(E_ALL)
    from my code but still it gives me the following notice.
    Code:
    Notice: Undefined index: action in /var/www/vhosts/semanticnotion.com/httpdocs/cafe/view/instructions.php on line 5
    what should i do to remove this notice.

    on instructions page
    Code:
    <form method="post" action="instructions.php?action=add&id=<?php echo $_GET['id'];?>">
    and on the top of this page i get the action e.g
    Code:
    $action=$_GET['action'];
    but this give me the notice that "action" is undefined.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    what should i do to remove this notice.
    check for the variable before you access it.
    Code:
    $action = isset($_GET['action']) ? $_GET['action'] : "default value";

    Comment

    • dlite922
      Recognized Expert Top Contributor
      • Dec 2007
      • 1586

      #3
      In addition to Dormilich's suggestion...

      You should check your PHP configuration. It could have error_reporting set to E_ALL.

      To turn it off set it to E_NONE either in your code or in your php configuration.

      Also check out 'display_errors ' configuration parameter. This turns all error reporting on or off regardless of the value for 'error_reportin g'.

      Dan

      Comment

      Working...