php - get $_GET and $_POST values, but not $_COOKIE values -


i use $_request, don't want value if came cookie. best way this? how it. thanks

$value=isset($_get['name'])?$_get['name']:(isset($_post['name'])?$_post['name']:null); 

i use $_request, don't want value if came cookie.

those 2 mutually-exclusive statements, i'm afraid. according the php docs, $_request is:

an associative array default contains contents of $_get, $_post , $_cookie.

if want use $_get , $_post , explicitly don't want $_cookie you'll have use them individually.

in general it's idea abstract infrastructure dependencies anyway, can make function (or, better yet, object) gets values you're looking for. maybe simple this:

function getrequestvalue($name) {     if (isset($_get[$name])) {         return $_get[$name];     }     if (isset($_post[$name])) {         return $_post[$name];     }     // throw error?  return default value or null? } 

Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -