Converting minutes and seconds in seconds
I'm not familiar with PHP too much but globals are usually considered harmful. I don't know what's the best practice in PHP but passing the $warning argument by reference seems a good idea here.
When a field is not posted you get various PHP notices. I guess it's better to avoid these notices:

PHP Notice:  Undefined index: min in /tmp/x.php on line ...
PHP Notice:  Undefined index: sec in /tmp/x.php on line ...


A robust code should handle these cases.
tmpsec and min_in_sec are not initialized in every code paths, so you can get notices about these too when there is no min key in the $_POST array:

PHP Notice:  Undefined variable: tmpsec in /tmp/x.php on line 24
PHP Notice:  Undefined variable: min_in_sec in /tmp/x.php on line 2


I think it's cleaner to initialize all variables. It also could help debugging since you don't have to ignore lots of PHP notice messages when you are looking for an uninitialized global variable.
tmpsec and min_in_sec could be omitted if you reorganize the code to not count anything until it is sure that there isn't any input error. (See below.)
A small note: The function is a little bit inconsistent: it allows 60 as minute but doesn't as seconds. It would be cleaner and more common to set one hour as hours = 1, minutes = 0 and seconds = 0.




$warning = array();

function val_duration(&amp;$warning, $min, $sec, $required = false) {
    if (empty($min) &amp;&amp; empty($sec)) {
        if ($required) {
            $warning['duration'] = "The duration is a required field";
        }
        return NULL;
    }

    if (!ctype_digit($min) || $min &gt; 61) {
        $warning['min'] = 'The minutes must contain a positive numeric value between 1 and 60';
    }
    if (!ctype_digit($sec) || $sec &gt; 59) {
        $warning['sec'] = 'The seconds must contain a positive numeric value between 1 and 59';
    }
    if (!empty($warning)) {
        return NULL;
    }

    return $min * 60 + $sec;
}