如何将post值指定为全局变量

Is there a way in php where you can assign a post value to a variable.

My current code.

global $CustomShippingRate;

$CustomShippingRate = empty($_POST['custom-shipping']) ? 0 : floatval($_POST['custom-shipping']);

Currently I get an error :

error: CustomShippingRate uninitialized

error: Exception has occurred. Notice: Undefined variable: CustomShippingRate

please note a post variable is a global itself already but if you want to define a new varialbe based on post data, you can define a variable outside of your local scope and then inside ur scope use global syntax or $GLOBALS[..] and assign a new value to it.