Input array in array
Is it possible to create开发者_JS百科 an array in an array for inputs?
So:
<input type="text" name="array[array[]]" />
Thanks.
A two dimensional array is an array inside an array. Many questions like this...
<input type="text" name="import[fields][0]" >
In HTML
<input type="text" name="import[fields][0]" >
<input type="text" name="import[fields][1]" >
<input type="text" name="import[fields][2]" >
IN PHP
<?php
if ( isset($_POST['submit']) )
{
print_r($_POST['field']);
}
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="text" name="field[one][1]" />
<input type="text" name="field[one][2]" />
<input type="text" name="field[one][3]" />
<br /><br />
<input type="text" name="field[two][1]" />
<input type="text" name="field[two][2]" />
<input type="text" name="field[two][3]" />
<br /><br />
<input type="submit" name="submit" />
</form>
精彩评论