From ec8d551a7d1f9a515439c3bb7ee7d2acb09b941f Mon Sep 17 00:00:00 2001 From: ahwelp Date: Thu, 1 Aug 2019 14:07:14 +0000 Subject: [PATCH] Update 'src/RR/Request.php' --- src/RR/Request.php | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/RR/Request.php b/src/RR/Request.php index eca8421..581659a 100755 --- a/src/RR/Request.php +++ b/src/RR/Request.php @@ -28,11 +28,27 @@ class Request{ } public static function requiredParamArray($parname, $type, $default = '', $options = Array() ){ - + // POST has precedence. + if (isset($_POST[$parname])) { + $param = $_POST[$parname]; + } else if (isset($_GET[$parname])) { + $param = $_GET[$parname]; + } else { + return $default; + } + return $param; } - public static function optionalParam(){ - + public static function optionalParam($parname, $type, $default = '', $options = Array()){ + // POST has precedence. + if (isset($_POST[$parname])) { + $param = $_POST[$parname]; + } else if (isset($_GET[$parname])) { + $param = $_GET[$parname]; + } else { + return $default; + } + return $param; } public static function optionalParamArray(){