检查是否在php中按下了提交按钮

I have been tackling this problem for some time and have spent a lot of time searching for a solution. When calling a function, I would like to know if the the submit button of the form was pressed.

I found some similar situations that called for using isset(). I don't make it to the "else" part in this code. I also followed the suggestion of using array_key_exists() and run into the same problem.

        if(!isset($_POST['subpic'])) {
        $pic .= "<form name=\"bg\" enctype=\"multipart/form-data\" method=\"post\" action='$_SERVER[PHP_SELF]'>
                        <p><input type=\"file\" name=\"bgpic\"></p>
                        <p><input type=\"submit\" name=\"subpic\" value=\"Submit\"></p>
                    </form>";
    }else{
            $pic .= "<p>Do something esle</p>";
    }   

Thank you in advance for any help is greatly appreciated.