I have a HTML form with field names like field11, field12, field13 in the first row and field21, field22, field23 in the second row and so on. I have this dynamic naming structure, because the user sets the number of rows and columns. I use two nested PHP for loops to build this table. Everything works fine until I submit the form and wish to retrieve the values on the next page. To retrieve field21, I need to use $_POST["field21"]. But I am using this inside a double for loop where $i=2 and $j=1. In essence, I need to use something like $_POST["field . $i . $j"]. I am not able to get the correct syntax.
for ($j = 1; $j <= $sailings; $j++) {
for ($i = 1; $i < $ratecols; $i++) {
echo "<td><input name='field" . $j . $i . "' id='field" . $j . $i . "' type='text'></td>";
}
}