p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: Another problem


Message #1 by "Jason DeWitt" <roxet@c...> on Thu, 25 Apr 2002 09:57:06 -0500
I'm having another strange problem. I'm just reaquainting myself with PHP,
so you might have to bear with me. =)

I have a script for a CMS. I'm going to have registered users with multiple
permission levels. I'm writing the script to change their level, it prints
out a form listing the username and has a drop-down menu to select the
level. Also, there is a radio button (named "modify") to select which user
you will modify. Everything works good, but I am trying to take into account
the fact that someone might forget to select a radio button and I do it like
this:

if (!$_REQUEST["modify"]) {
    echo "Please select the radio button for the user you want to modify";
} else {
    // do stuff here
}

when it hits this test, I get the results that I expect but I get this error
message:
Notice: Undefined index: modify in C:\www\admin\changeuserlevel.php on line
12

This is obviously because there is no data being passed from the "modify"
radio button. So is this Notice unaviodable? or is there some way I can get
rid of it?

Thanks
Jason


Message #2 by "Nikolai Devereaux" <yomama@u...> on Thu, 25 Apr 2002 09:34:22 -0700
> This is obviously because there is no data being passed from the "modify"
> radio button. So is this Notice unaviodable? or is there some way 
> I can get rid of it?

use isset() instead.

 http://www.php.net/isset

if(! isset($_REQUEST['modify']))
  ...


take care,

nik
Message #3 by "Jason DeWitt" <roxet@c...> on Thu, 25 Apr 2002 11:55:42 -0500
thanks nik

I knew it would be something easy like that! I just couldn't think of it.


----- Original Message -----
From: "Nikolai Devereaux" <yomama@u...>
To: "beginning php" <beginning_php@p...>
Sent: Thursday, April 25, 2002 11:34 AM
Subject: [beginning_php] RE: Another problem


>
> > This is obviously because there is no data being passed from the
"modify"
> > radio button. So is this Notice unaviodable? or is there some way
> > I can get rid of it?
>
> use isset() instead.
>
>  http://www.php.net/isset
>
> if(! isset($_REQUEST['modify']))
>   ...
>
>
> take care,
>
> nik
>
>


  Return to Index