Hello DPers, I am just wondering if let's say we have an array like: <?php $valuearray = array("request1","request2","etc"); ?> PHP: and we want to detect if there are any other parameters in a post request via a function that returns true if there are other parameters and false if not. Example call of that function: <?php $valuearray = array("request1","request2","etc"); if(detectpost($valuearray)) { echo 'there are other parameters on POST.'; } else { echo 'there are no other parameters on POST.'; } ?> PHP: Thank you, -AT-XE
Well.. it's not very hard. Just try to find element which not exists in $_POST array and return "false"..
function detectpost($arrayvars,$_POST){ foreach($_POST as $item){ if(!in_aray($item,$arrayvars)){ return true;} } return false; } PHP: Call it like: <?php $valuearray = array("request1","request2","etc"); if(detectpost($valuearray,$_POST)) { echo 'there are other parameters on POST.'; } else { echo 'there are no other parameters on POST.'; } ?> PHP: Peace,