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() !!} 

answer form submit

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

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -