iam trying edit student details.
iam fetch values database. blood group fetch database display select box. , display other blood groups in same select box.
select class="form-control" name="studbldgrp" id="studbldgrp"> option value="{{$student->studbldgrp}}">{{$student->studbldgrp}}</option> option value="o+ve">o+ve</option> option value="o-ve">o-ve</option> <option value="a+ve">a+ve</option> <option value="a-ve">a-ve</option> <option value="b+ve">b+ve</option> <option value="b-ve">b-ve</option> <option value="ab+ve">ab+ve</option> <option value="ab-ve">ab-ve</option> <option value="other">other</option> </select>
my problem if im fetch value a+ ,and display in select box. in option value field. no need again value(a+)a +ve in select option field.
how disable field???
create array of groups. iterate on , don't print value matches $student->studbldgrp. array in php:
$groups = array( 'o+ve', 'o-ve', 'a+ve', 'a-ve', 'b+ve', 'b-ve', 'ab+ve', 'ab-ve', 'other' );
blade template:
<select class="form-control" name="studbldgrp" id="studbldgrp"> <option value="{{$student->studbldgrp}}">{{$student->studbldgrp}}</option> @foreach ($groups $group) @if ($group != $struden->studbldgrp) <option value="{{ $group }}">{{ $group }}</option> @endif @endforeach </select>