php - Laravel throwing error on foreach() loop on POST -
i have survey application built laravel. when users creating answers questions, enter them in corresponding textboxes (added dynamically jquery). have create.blade.php code in partial follows:
{!! form::open(['url' => 'surveys']) !!} @foreach( $questions $question ) <h2>{{$question->text}}</h2> <div id="input_fields_wrap_{{ $question->id }}"> <div class="form-group"> {{--{!! form::label('answer', 'answers:') !!}--}} <div class="input-group"> {!! form::text('answers[]', null, ['class' => 'form-control']) !!} <span class="input-group-btn"><button class="btn btn-default btn-danger remove_field" type="button">remove</button></span> </div> </div> </div> <div id="{{ $question->id }}" class="add_answer_button btn btn-primary" style="margin-bottom:15px" type="text">add answer</div> @endforeach <div class="form-group"> {!! form::submit('finish survey', ['class' => 'btn btn-primary form-control']) !!} </div> {!! form::close() !!}
however when submit forms clicking on 'finish survey' submit button, laravel throwing me error:
invalid argument supplied foreach() (view: /home/kevin/phsa-dev/my-follow-up/resources/views/questions/create.blade.php)
my mistake redirecting page did not exist in questioncontroller. 'url' => 'questions'
fixed it.
Comments
Post a Comment