Entry
how do I pass a 2 dimensional array to a php script
Apr 17th, 2002 04:42
Techek, Guest,
HTML:
<table border=1>
<tr>
<td><input type="checkbox" value="1" name="testing[a][1]">A1</td>
<td><input type="checkbox" value="1" name="testing[b][1]">B1</td>
<td><input type="checkbox" value="1" name="testing[c][1]">C1</td>
</tr>
<tr>
<td><input type="checkbox" value="1" name="testing[a][2]">A2</td>
<td><input type="checkbox" value="1" name="testing[b][2]">B2</td>
<td><input type="checkbox" value="1" name="testing[c][2]">C2</td>
</tr>
<tr>
<td><input type="checkbox" value="1" name="testing[a][3]">A3</td>
<td><input type="checkbox" value="1" name="testing[b][3]">B3</td>
<td><input type="checkbox" value="1" name="testing[c][3]">C3</td>
</tr>
</table>
<input type="submit" value="Test!">
PHP:
<?php
while(list($index_x, $dummy_x) = each($testing) {
while(list($index_y, $dummy_y) = each($testing[$index_x])) {
$value = $testing[$index_x][$index_y];
echo "Testing[".$index_x."][".$index_y."] = ".$value."<br>\n";
}
}
?>
Hope this helps? In any case feel free to give me a call about what you
found out, okay?