According to this line:
printf('<p><tr><td><input type="radio" id="%1$s" name="box"></td>
<td><label for="%1$s">%1$s</td></label>
<td><label for="%1$s">%2$s</td></label></tr></p>',
basename($file), date('F d Y, H:i:s', filemtime($file)));
Your input name is 'box'
. You can access it after the form submission via $_POST['box']
, something along the lines of:
<?php if(isset($_POST['box'])) { // This will hide the video prior to submission ?>
<video width="320" height="240" controls>
<source src="/media/<?php echo $_POST['box']; ?>" type="video/mp4">
</video>
<?php } ?>
Update
Admittedly I should have seen this sooner, but your input name is being repeated many times. You don't want to have two elements in the same form that share the same name. You need to differentiate it them somehow, and in general you can achieve having many elements with the same name by simply making it an array:
printf('<p><tr><td><input type="radio" id="%1$s" name="box[]"></td>
Now you should be able to see an array when you submit and var_dump( $_POST['box'] )