[ACCEPTED]-is it possible to have double nested input tag arrays in html?-multidimensional-array
You are going to need to supply indexes 10 into the first part of each field or else 9 there is nothing to nest, and if it did 8 work, it wouldn't look like a grid on the 7 other end:
Row 1:
name="list[0][]"
Row 2:
name="list[1][]"
etc.
Finally, your 6 server needs to support this as PHP and 5 Rails do out of the box. I am not sure about 4 other server technologies. For an example, the 3 following HTML when posted to PHP:
<form action="post.php" method="POST" accept-charset="utf-8">
<input type="text" name="list[0][]" value="1" />
<input type="text" name="list[0][]" value="2" />
<input type="text" name="list[0][]" value="3" />
<input type="text" name="list[1][]" value="4" />
<input type="text" name="list[1][]" value="5" />
<input type="text" name="list[1][]" value="6" />
<input type="text" name="list[3][]" value="7" />
<input type="text" name="list[3][]" value="8" />
<input type="text" name="list[3][]" value="9" />
<input type="submit" name="Send" value="Send" id="Send" />
</form>
If in 2 the PHP the following code exists:
<?php print_r($_POST['list']); ?>
The output 1 is:
Array
(
[0] => Array
(
[0] => 1
[1] => 2
[2] => 3
)
[1] => Array
(
[0] => 4
[1] => 5
[2] => 6
)
[3] => Array
(
[0] => 7
[1] => 8
[2] => 9
)
)
HTML allows you to have several inputs with 7 the same name, which are sent to the server 6 through POST or GET as a comma separated 5 array, which most (all?) server side languages 4 recognize as a native array.
There is no 3 native way of making a multidimensional 2 array with pure HTML without you rolling 1 something yourself with javascript.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.