Undefined Index Errors

From: Date: Fri, 06 Feb 2004 15:51:46 +0000
Subject: Undefined Index Errors
Groups: php.general 
Request: Send a blank email to php-general+get-177019@lists.php.net to get a copy of this message
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

« previous php.general (#177019) next »