do this: $op = isset($_GET['op']) && !empty($_GET['op']) ? $_GET['op'] : '';
"J�Rgen" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > It's me again, i don't mean to be a bugger, but i really like to learn as > much as possible, that's why i ask (or will ask so many questions). > > Consider the following (i shortened this a lot, but it will do the trick) > > $op = $_GET['op']; > switch ( $op ) > { > case "admin": > DoLogin(); > break; > > default: > ShowHomepage(); > break; > } > > PHP shoots a Notice Message telling me that there is an undefined index > Undefined index: act in g:\apache_web\intern\looney\index.php on line 177 > > This accects the code shown above. > > Ok, am i correct in assuming that it pops this message because $op is not > defined as anything yet? > > If so,should i always just do this > > $_POST['op'] = ''; > $op = $_GET['op']; > switch ( $op ) > { > //Code here > } > > Or would it be better and more space efficient to do this > $op = isset($_GET['op']); > switch ( $op ) > { > //Code here > } > Cause if i do that the Notice Message dissapears for some reason i yet fail > to grab. > I would really appreciate if somebody could explain to me why the Notice > dissapears when using isset(), and also what is the best method to use > rather then the two shown above? > How do you guys&girls handle this? > > Thanks a lot in advance for your time and patience! > > Best regards from Vienna, > J�rgen > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

