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

vipin93's avatar
Level 13

Updating info?

How can we update info of user with text, select , in 5.3

like my view

<fieldset readonly>
      <div class="form-group">
        <label for="reg_no">Registration No.</label>
        <input type="text"  name="reg_no" class="form-control" value="{how to fetch students data and old value }" readonly>
      </div>

       </fieldset>
      <div class="form-group">
        <label for="student_name">Students Name</label>
        <input type="text" class="form-control" id="student_name" value="{!! $s->student_name !!}" name="student_name" placeholder="Name">
      </div>
      <label for="course">Students Class</label>
        <select class="form-control" id="course" name="course" ">
          <option value="">---Select Class</option>
         @foreach($courses as $key=>$value)
           @if (Input::old('course') == $key)
           <option value="{{ $key }}" selected>{{ $value }}</option>
           @else
          <option value="{{ $key }}">{{ $value }}</option>
          @endif
          @endforeach
        </select>
        <br>
        <label for="section">Section</label>
        <select class="form-control" id="section" name="section">
         <option value="">---Select Section</option>
         @foreach($sections as $key=>$value)
           @if (Input::old('section') == $key)
           <option value="{{ $key }}" selected>{{ $value }}</option>
           @else
          <option value="{{ $key }}">{{ $value }}</option>
          @endif
          @endforeach
            
        </select>
        <br>
  
        <div class="form-group">
            <label for="year_of_admission">Year Of Addmission</label>
            <input type="text" class="form-control" id="year_of_admission" name="year_of_admission" placeholder="2016" value="{!! $s->year_of_admission !!}">
        </div>

        <div class="form-group">
            <label for="last_school">Last School</label>
            <input type="text" class="form-control" id="last_school" name="last_school" placeholder="ex-SS public School" value="{!! $s->last_school !!}">
        </div>

         <label for="status">Status</label>
        <select class="form-control" id="status" name="status">
          <option value="0">Active</option>
          <option value="1">Deactive</option>
        </select>
        <br>

my controller


        $courses = DB::table("courses")->pluck("name","id");
        $sections = DB::table("sections")->pluck("name","id");
        $cityies = DB::table("cities")->pluck("name","id");
        $state = DB::table("states")->pluck("name","id");
        return view('students.edit.edit_students',compact('s','courses','sections','cityies','state'));

thanks

0 likes
3 replies
WebKenth's avatar

Put it in a <form> and send it to a controller function and save it ?

It's pretty much Laravel 101

vipin93's avatar
Level 13

actually How can i used {{ old }} in update form

Please or to participate in this conversation.