从视图中的php变量中获取值

I have a form where I have multiple upload buttons. Banner, Cover and HeadlinerX, the X is replaced by a number 1,2...X This means I can have multiple buttons for upload headliners.

I have this hidden input (in my view) where I store the amount of headliners.

<input type="hidden" name="qtd_headliners" id="qtd_headliners" value="<?php echo $qtd_headliners?>" />

I tried this way (method in controller) to access it but it doesn't do anything it only adds banner and cover.

public function uploadOptions(){

    $opt = array();

    for ($i=1; $i <= $_POST['qtd_headliners']; $i++) { 
        if(!array_key_exists($i, $_POST))
            continue;

        $headliner = $_POST('headliners'.$i);
        $opt[$i] = $headliner;
        $this->set('Headliner' . $opt[$i] , 'debug');
    }

    array_push($opt, 'banner', 'cover');

    return $opt;
}

Can anyone point me in the right direction?

After a couple of minutes re-reading the code I found my error and solution.

public function uploadOptions(){
    $opt = array();
    array_push($opt, 'banner', 'cover');

    for ($i=1; $i <= $_POST['qtd_headliners']; $i++) { 
        $headliner = 'headliner'.$i;
        array_push($opt, $headliner);
    }

    return $opt;
}

Thanks anyway @Cili and @arilia

Check this working version of the function:

function uploadOptions(){

    $opt = array();

    for ($i=1; $i <= $_POST['qtd_headliners']; $i++) { 
        if(!array_key_exists('headliners'.$i, $_POST)) // Note the 'headliners' string
            continue;

        $headliner = $_POST['headliners'.$i]; // $_POST is an array, so access its items with []
        $opt[$i] = $headliner;
        $this->set('Headliner' . $opt[$i] , 'debug');
    }

    array_push($opt, 'banner', 'cover');

    return $opt;
}