You can either:

1. put @ in front of each variable, e.g.
        $adminID = @$_ENV['HTTP_REMOTE_USER'];

2. change your error reporting level:
        error_reporting(E_ALL ^ E_NOTICE);

Cameron B. Prince wrote:

Hey guys,

Here's a chunk of code from the top of a multi-function page I converted
from Perl to PHP:

$userid   = $_REQUEST['USERID'];        # USERID = selected userid
$dlist    = $_REQUEST['DLIST'];         # DLIST = indicates who to display
$action   = $_REQUEST['ACTION'];        # ACTION = indicates approval or
denial
$more     = $_REQUEST['MORE'];          # MORE = ID of person to show
details
$delete   = $_REQUEST['DELETE'];        # DELETE = indicates to delete user
$ltr      = $_REQUEST['LTR'];           # LTR = start ltr of last name
$modpwd   = $_REQUEST['MODPWD'];        # MODPWD = indicates modifying pwd
$expire   = $_REQUEST['EXPIRE'];        # EXPIRE = indicates to expire pwd
$upduser  = $_REQUEST['UPDUSER'];       # UPDUSER = indicates user info
updated
$denyuser = $_REQUEST['DENYUSER'];      # DENYUSER = indicates user was
denied
$reason   = $_REQUEST['REASON'];        # REASON = Reason user was denied

$adminID = $_ENV['HTTP_REMOTE_USER'];

I'm creating some strings from array elements obviously. The issue is, the
array elements don't always exist depending on which function you are
running. And when they don't, the server log is full of undefined index
errors. Is there a way I can avoid these errors without adding a
"if(isset(...))" around each one?

Thanks,
Cameron


-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to