In same page, how to get value from radio button and use it for the coming radio button.
Example:
OCountry OGender
If i selected Country, then the below radio button option will show:
OAmerica OEngland OAustralia OMalaysia
But all of this is before submit button. Is all in one page.
So below is my code. Can anyone give me some advise?
1.Blade.
<script type="text/javascript">
function show1(){
document.getElementById('div1').style.display ='none';
}
function show2(){
document.getElementById('div1').style.display = 'block';
}
</script>
{!! Form::open(['action'=>'PostsController@store','method'=>'POST']) !!}
<h2>Hi,{{Auth::user()->name}}</h2><br>
<div class="form-group">
{{Form::label('roomkey','Key Number:')}}<br>
@foreach($rkeys as $rkey)
@if($rkey->status == "1")
<div class="form-check form-check-inline">
<input onclick="show1()" class="form-check-input" type="radio" name="roomkey" hidden selected><br>
<input
onclick="show2()"
class="form-check-input"
type="radio"
name="roomkey"
value="{{$rkey->roomkey}}"
disabled>
{{$rkey->roomkey}}<br></div>
@else
<div class="form-check form-check-inline">
<input onclick="show1()" class="form-check-input" type="radio" name="roomkey" hidden selected><br>
<input onclick="show2()" class="form-check-input" type="radio" name="roomkey" value="{{$rkey->roomkey}}" > {{$rkey->roomkey}}<br></div>
@endif
@endforeach
</div>
//so this is the after the 1st part of radio button form.
<div id="div1" class="hide">
<hr><p>Room Number:</p>
@foreach ($room as $room)
@foreach($rkeys as $rkey)
@if($rkey->roomkey == $room->roomkey)
<input type="checkbox" value="{{$room->roomNum}}" name="roomNum">
{{$room->roomNum}}
@endif
@endforeach
@endforeach
</div>
<br>
<input name="status" type="hidden" value="1">
{{Form::submit('Submit',['class'=>'btn btn-primary'])}}
{!! Form::close() !!}