I am working on a php code from Code#A as shown below in which on debug (Line#A) prints the following:
Code#A
$mp4_files = array_values($mp4_files);
print_r($mp4_files); // Line#A
Output from Line#A:
Array ( [0] => 36031P.mp4 [1] => hello.mp4 )
Code#B
print_r($_POST['id']); // Line#B
if (!empty($_POST['id']))
{
foreach ($mp4_files as $f)
{
print_r($f); // Line#C prints 2 values 36031P.mp4hello.mp4
$parts = pathinfo($f);
switch ($parts['extension'])
{
case 'mp4' :
$filePath = $src_dir . DS . $f;
system('ffmpeg -i ' . $filePath . ' -map 0:2 -ac 1 ' . $destination_dir . DS . $parts['filename'] . '.mp3', $result);
}
}
}
Line#B from Code#B has 2 values: 0 and 1 which comes on the click of a button from 2 different rows.
When 1st row button is clicked, value 0 show up at Line#B
When 2nd row button is clicked, value 1 show up at Line#B
Problem Statement:
I am wondering what changes I should make in the php code (Code#B) above (which have Line#B and Line#C) so that:
When 1st row button is clicked, Line#C prints 36031P.mp4.
When 2nd row button is clicked, Line#C prints hello.mp4.