php - if( $_POST['id'] is set){...} else if ($_GET['id'] is set){...} -
this psuedocode:
if( $_post['id'] set){ $id = $_post['id'] }else if($_get['id'] set){ $id = $_get['id'] }
how can writ?
if(isset($_post['id'])) { $id = $_post['id']; } else if(isset($_get['id'])) { $id = $_get['id']; }
perhaps, however, you'd rather use $_request
?
if(isset($_request['id'])) { $id = $_request['id']; }
the precedence of _post
, _get
, , _cookie
can set via configuration directives.
Comments
Post a Comment