Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

gust's avatar
Level 1

Form submit is going blank

Quiz app,I am trying to submit a form with a model named question along with a hasmany relation to its choices(choice) be updated. But its going to blank I tried using named routes and url.

    <form action="{{route('question.update',$question->id)}}">
        {{csrf_field()}}
        <ul>
          <label for="{{$question->question}}">Title</labe>
          <input type="text" name="{{$question->question}}" value="{{$question->question}}">
          @foreach ($question->choice as $choice)
                @if($choice->is_correct == 1)
                    <li> Correct:<input type="text" value="{{$choice->text}}"></li>
                @else
                    <li><input type="text" value="{{$choice->text}}"></li>
                @endif
          @endforeach
        </ul>
        <input type="submit">
    </form>

should be getting a dd

    public function update(Request $request, $id)
    {
        dd("we got to question controller update");
    }
0 likes
4 replies
fraserk's avatar

No Form method. try adding

method="put or patch" to the form

//and add the method field
{{method_field('post)}}

gust's avatar
Level 1

i added <form action="{{route('question.update',$question->id)}}" method="PUT"> {{method_field('put')}} {{csrf_field()}} and it still goes blank

gust's avatar
Level 1

thanks, I got it to work, It didn't go with {{method_field('post')}} but i tried it with this combination

<form action="{{route('question.update',$question->id)}}" method="POST">
        {{method_field('PUT')}}

and it worked

1 like

Please or to participate in this conversation.