I have a script using foreach that generates the variables $ d, $ m, which get the value of a mysql query and put this value in the input
echo "
<input type='text' name='tipo' value='".$d."'>
<input type='text' name='metragem' value='".$m."'>
";
Then I wanted each field to be unique, because the query returns several rows, so I added $ n
$n = 0;
foreach($unidades as $unidade){
$n++
echo "
<input type='text' name='tipo".$n."' value='".$d."'>
<input type='text' name='metragem' value='".$m."'>
";
}
So far so good, but I need now to put all of them together in a single $ valued variable and $ mtotal, eg:
$mtotal = 'tipo'.$n1.'|'.'tipo'.$n.'|'.'tipo'.$n(quantos n tiverem);