I have a form that dynamically generates inputs based on a user-given number:
@for($i = 0; $i < $userno['userno']; $i++)
<div class="form-group">
{!! Form::label('user[$i][name]','User Name:') !!}
{!! Form::text('user[$i][name]', null, ['class' => 'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('user[\{{ $i \}}][email]','User E-mail Address:') !!}
{!! Form::text('user[\{{ $i \}}][email]', null, ['class' => 'form-control']) !!}
</div>
@endfor
Here you can see two different methods I have tried to insert the iterator into the field name (I have added escaping slashes in the second input because the forum code seems to remove anything in double curly braces). Here is the output:
user: {
$i: {
name: "cxvzxcv"
},
<?php echo e($i); ?>: {
email: "zxcvzx@zcxcx.com"
}
},
Obviously neither will work when I try to retrieve the data. So how can I generate these fields and then retrieve their data in a Blade template?
TIA
Edit: I've managed to sort-of fix this by simply using standard HTML for the inputs rather than using the Form façade, but it would be nice to get it working with the façade if possible.