Good afternoon everyone. I have a form that shows the fields in the form of a table:
echo "<table style='text-align: center; widtd: 280pt;' border='1'>";
// Cabeçalho da tabela:
echo '<tr><td>AAA</td><td>BBB</td><td>CCC</td><td>DDD</td><td>EEE</td></tr>';
for ($i=0; $i<3; $i++){
echo "<tr>";
for ($j=0; $j<4; $j++){
if (($i==0) && ($j==0)){
echo "<td style='text-align: center; widtd: 100pt;'>AA</td>";
}
if ($i==0) {
echo "<td><input name='linhaum$j'></td>";
}
if (($i==1) && ($j==0)){
echo "<td style='text-align: center; widtd: 100pt;'>BB</td>";
}
if ($i==1) {
echo "<td><input name='linhadois$j'></td>";
}
if (($i==2) && ($j==0)){
echo "<td style='text-align: center; widtd: 100pt;'>CC</td>";
}
if ($i==2) {
echo "<td><input name='linhatres$j'></td>";
}
}
echo "</tr>";
}
echo "</table><br>";
I'm getting this form this way:
echo '<table style="text-align: center; widtd: 280pt;" border="1">';
echo '<tr><td>AAA</td><td>BBB</td><td>CCC</td><td>DDD</td><td>EEE</td></tr>';
for ($i=0; $i<3; $i++){
echo '<tr>';
for ($j=0; $j<4; $j++){
$linhaum = $_POST["linhaum$j"];
$linhadois = $_POST["linhadois$j"];
$linhatres = $_POST["linhatres$j"];
if (($i==0) && ($j==0)){
echo '<td style="text-align: center; widtd: 100pt;">AA</td>';
}
if ($i==0) {
echo "<td>$linhaum</td>";
}
if (($i==1) && ($j==0)){
echo '<td style="text-align: center; widtd: 100pt;">BB</td>';
}
if ($i==1) {
echo "<td>$linhadois</td>";
}
if (($i==2) && ($j==0)){
echo '<td style="text-align: center; widtd: 100pt;">CC</td>';
}
if ($i==2) {
echo "<td>$linhatres</td>";
}
}
echo '</tr>';
}
echo '</table><br>';
What I need: Convert this table, already populated with the captured data, into a variable.
Example of what I need:
$minhavar = "a tabela que foi preenchida com os valores do formulário";
[...];
echo $minhavar;
Thank you!