RE: [PHP] Undefined Index Errors

2004-02-06 Thread Cameron B. Prince
> 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
> >

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



Re: [PHP] Undefined Index Errors

2004-02-06 Thread John W. Holmes
From: "Cameron B. Prince" <[EMAIL PROTECTED]>

> 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?

Adjust your error_reporting() level so these notices don't show up.

---John Holmes...

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



Re: [PHP] Undefined Index Errors

2004-02-06 Thread Adam Bregenzer
On Fri, 2004-02-06 at 10:51, Cameron B. Prince wrote:
> 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?

If you know which variables are required per 'function' that is being
called wrap an if around these variable declarations in blocks.  You
will still have ifs, but you should have a lot fewer.  If by function
you mean actual functions then you could move these lines to the top of
their respective functions.

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

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



Re: [PHP] Undefined Index Errors

2004-02-06 Thread Marek Kilimajer
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