I have a page where I want to generate download links with labels these labels are generated in a for and I want to click on the label you can download for example file 1, then on the next generated label you can download the file 2 and so on I already have the name of the files and their routes, but I do not know how to download the files
In this image you can see that I generate the problem number and in the link I want to leave the option to download the file this is the code I use to generate the links but it does not work because when I enter the page, the window opens to download only the first example without clicking on the link, I have the files in a folder called uploads:
for ($i=1; $i <=count($valores) ; $i++) {
echo "<h4>problema ".key($valores)."</h4>";
echo "<p>Intentos realizados ".$valores[$i]."</p>";
$nombre=''.key($valores).'_'.$_SESSION["usuario"][0]["matricula"].'.c';
$ruta='subidas/'.key($valores).'_'.$_SESSION["usuario"][0]["matricula"].'.c';
//header ("Content-Disposition: attachment; filename=".$nombre);
//header ("Content-Type: text/plain");
//header ("Content-Length: ".filesize($nombre));
//readfile($nombre);
//echo "<a href='cuenta.php'>descargar ejercicio</a>";
next($valores);
}