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?