try
@foreach ($products as $i => $product)
{!! Form::label('product', $product->longName) !!}
{!! Form::hidden("nameEn[$i]", $product->nameEn) !!}
{!! Form::hidden("orderNum[$i]", $orderNum) !!}
{!! Form::hidden("price[$i]", $product->price) !!}
{!! Form::text("qty[$i]",Input::old("qty.$i"), ['class' => 'form-control']) !!}
@endforeach
Lewolf said:
try
@foreach ($products as $i => $product) {!! Form::label('product', $product->longName) !!} {!! Form::hidden('nameEn[$i]', $product->nameEn) !!} {!! Form::hidden('orderNum[$i]', $orderNum) !!} {!! Form::hidden('price[$i]', $product->price) !!} {!! Form::text('qty[$i]',Input::old("qty.$i"), ['class' => 'form-control']) !!} @endforeach
Thank you for the reply. It did not worked that way but it works with:
@foreach ($products as $i => $product)
{!! Form::label('product', $product->longName) !!}
{!! Form::hidden('nameEn[]', $product->nameEn) !!}
{!! Form::hidden('orderNum[]', $orderNum) !!}
{!! Form::hidden('price[]', $product->price) !!}
{!! Form::text('qty[]',Input::old('qty'), ['class' => 'form-control']) !!}
@endforeach
Now my problem is how to sotre that array in the database. What do you think, do I have to open another thread for this and mark this as solved or I can expect the reply here.
Thanks!
Because 'qty[$i]'
is a string literal with no interpolation. "qty[$i]"
would evaluate the variable inside the string.
lagbox said:
Because
'qty[$i]'
is a string literal with no interpolation."qty[$i]"
would evaluate the variable inside the string.
Thanks for pointing that out. Of course you are right, I was writing that in a hurry - mea culpa.
I have updated my reply with double quotes.
@Lameboy - IMHO, a new question better fits into a new thread, for this would make it searchable for other people having the same issue.
if you don't want to search things in db you can serialize arrays and store it as a string in db.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community