Page 1 of 1

how can I use isset values?

Posted: Tue May 19, 2009 7:27 pm
by joelitos
Can you guys explain me what does this mean?

Code: Select all

 
$cat = isset($_GET['subject']) &&
is_numeric($_GET['subject'])?$_GET['subject']:null;
$prod = isset($_GET['menu']) && is_numeric($_GET['menu'])?$_GET['menu']:null;
$menu_type = isset($_GET['menu_type']) && is_string($_GET['menu_type'])?$_GET['menu_type']:null
 
And how can I use this values, give me as much opinios as you can.

I want to know how can I use a value when is isset($_GET, is_numeric($_GET, $_GET and null.

one example would be

Code: Select all

$class = !is_null($cat) && $cat==$row['id']?' class="selected"':''
Thank you..

Re: how can I use isset values?

Posted: Tue May 19, 2009 8:30 pm
by Benjamin

Code: Select all

$cat = isset($_GET['subject']) &&
is_numeric($_GET['subject'])?$_GET['subject']:null;
 
Is the same as:

Code: Select all

 
if (isset($_GET['subject'])) {
    $cat = $_GET['subject'];
} else {
    $cat = null;
}
 

Re: how can I use isset values?

Posted: Wed May 20, 2009 8:35 am
by joelitos
Thank you astions