Radio button onclick radio button
Hi as my title, i am going to get radio button onclick value to do a if else. below is my blade.
{!! Form::open(['action'=>'PostsController@store','method'=>'POST']) !!}
<h2>Hi,</h2><br>
<div class="form-group">
<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=""
disabled>
<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="" > <br></div>
@endif
@endforeach
</div>
<div id="div1" class="hide">
<hr><p>Room Number:</p>
@foreach ($room as $room)
@foreach($rkeys as $rkey)
@if($rkey->roomkey == $rkey->roomkey)
<input type="checkbox" value="" name="roomNum">
@endif
@endforeach
@endforeach
</div>
<br>
<input name="status" type="hidden" value="1">
{!! Form::close() !!}
2.Controller
public function create(Request $request)
{
//$keyno = Post::select('roomkey')->get();
// $keyno = Post::get()->pluck('roomkey')->toArray();
$rkeys = Keyno::all();
$posts = Post::all() ;
$room = Room::all();
return view('posts.create')->with('rkeys', $rkeys)->with('posts',$posts)->with('room',$room)->with('selected',$selected);
}
I was trying this code out, but it not work, no error,but it show out all the information in my room table T^T
To sum it up, i trying to do when i click on the key radio button, it will get the value and show the room that this key call open. Hope someone can help me T^T Please Table Post Table Room
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire