Answers for "form an array"

3

array in html form

You can also post multiple inputs with the same name and have them save into an array by adding empty square brackets to the input name like this:

<input type="text" name="comment[]" value="comment1"/>
<input type="text" name="comment[]" value="comment2"/>
<input type="text" name="comment[]" value="comment3"/>
<input type="text" name="comment[]" value="comment4"/>
If you use php:

print_r($_POST['comment']) 
you will get this:

Array ( [0] => 'comment1' [1] => 'comment2' [2] => 'comment3' [3] => 'comment4' )
Posted by: Guest on September-18-2021
0

form an array from i to j javascript

Array.from({ length: to-from+1 }, (_, i) => from + i)
Posted by: Guest on October-06-2021

Code answers related to "form an array"

Browse Popular Code Answers by Language