Level 122
clue?
Does it get to the controller? Does your print_f show?
Anything change in the database?
Any behaviour at all?
When you press submit, do you see pictures of fluffy kittens?
What? What?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Controller:
public function update(Request $request, $id)
{
$students = StudentModel::find($id);
$students->student_name = $request->input('student_name');
$students->roll_number = $request->input('roll_number');
print_r($students);
$students->save();
if ($save) {
return redirect()->back()->with('success', 'Save Successfully !!');
}
}
view :
@extends('layouts/mainlayout')
@section('content')
<a href="{{ URL::to('add-student') }}" class="btn btn-success">Add Student</a>
<a href="{{ URL::to('add-course') }}" class="btn btn-success">Add Course</a>
<a href="{{ URL::to('/') }}" class="pull-right btn btn-info">View all Student</a>
<div class="col-xs-offset-3 col-xs-6">
<h3 class="text-center">Add Student</h3>
@if (session()->has('success'))
<h1 class="text-center text-success">{{ session('success') }}</h1>
@endif
<form class="form-horizontal" method="PUT" action="{{ action('HomeController@update',$students['id'])}}" accept-charset="UTF-8">
<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
<div class="form-group">
<label class="control-label col-xs-3" for="student_name">Student Name</label>
<div class="col-xs-9">
<input type="text" name="student_name" id="student_name" class="form-control" value="{{$students->student_name}}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-3" for="roll_number">Student Roll</label>
<div class="col-xs-9">
<input type="number" name="roll_number" id="" class="form-control" value="{{ $students->roll_number}}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-3"></label>
<div class="col-xs-9">
<input type="submit" class="btn btn-success" name="submit" value="Submit">
</div>
</div>
</form>
</div>
</div>
@stop
sorry for misunderstanding. solved it I use method put in here. just put this code in the form
{{ method_field('PUT') }}
and
method=" post"
thats it thanks
Please or to participate in this conversation.