php - getting an Undefined index: id in submitting a form -
i got error yesterday , thought fixed it. submitting update form.
@extends('layouts.master') @section('content') <form action="{{url('/student/update')}}" method="post" role="form"> {{ csrf_field() }} {{method_field('put')}} <legend>create student</legend> <input type="hidden" name="id" class="form-control" value="{{$student->id}}"> <div class="form-group"> <label for="">name</label> <input type="text" class="form-control" name="name" value="{{$student->name }}"required="required"> </div> <div class="form-group"> <label for="">address</label> <input type="text" class="form-control" name="address" value="{{$student->address }}" required="required"> </div> <div class="form-group"> <label for="">phone</label> <input type="text" class="form-control" name="phone" value="{{$student->phone }}" required="required"> </div> <div class="form-group"> <label for="">career</label> <select name="career" class="form-control" required="required"> <option>select career</option> <option value="math"{{$student->career == 'math' ? 'selected' : ''}}>math</option> <option value="physics"{{$student->career == 'physics' ? 'selected' : ''}}>physics</option> <option value="engineering"{{$student->career == '' ? 'engineering' : ''}}>engineering</option> </select> </div> <button type="submit" class="btn btn-primary">update student</button> </form> @endsection
the error says relates clientcontroller on line 82.
protected function updateonestudent($parameters) { $studentid = $parameters['id']; return $this- >performputrequest("https://lumenapi.juandmegon.com/students/{$studentid}", $parameters); }
it same function giving me problem yesterday. problem was not calling function. performputrequest function this.
protected function performputrequest($url, $parameters = []) { $contents = $this->performauthorizerequest('put', $url, $parameters); $decodedcontents = json_decode($contents); return $decodedcontents->data; }
any appreciated.
thanks beginner point me in right direction. had code below.
protected function updateonestudent($parameters) { $studentid = $parameters['id'; return $this->performputrequest("https://lumenapi.juandmegon.com/students/{$studentid}", $parameters); }
i missed bracket id. should this
protected function updateonestudent($parameters) { $studentid = $parameters['id']; return $this->performputrequest("https://lumenapi.juandmegon.com/students/{$studentid}", $parameters); }
Comments
Post a Comment