RE: [PHP] Undefined Index Errors
| From: | Cameron B. Prince | Date: | Fri, 06 Feb 2004 16:44:15 +0000 |
| Subject: | RE: [PHP] Undefined Index Errors | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-177030@lists.php.net to get a copy of this message | ||
> 1. put @ in front of each variable, e.g.
> $adminID = @$_ENV['HTTP_REMOTE_USER'];
This worked very nicely...
Thank you!
> > 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
> >