Ad
Request Values Of Contoller Not Getting Value Of Select
This is a noob question, I send a post request
to my controller
and all it can get is the request of the input. What I want is I can also get the value of $cat
array.
Here's my blade:
@if (!$categories->isEmpty())
<form action="{{route('subcategory.store')}}" method="POST">
@csrf
<div class="row">
<div class="input-group mb-3 col-md-4">
<div class="input-group-prepend">
<label class="input-group-text" for="inputGroupSelect01">Choose Category:</label>
</div>
<select class="custom-select" id="inputGroupSelect01">
@foreach ($categories as $cat)
<option value="{{$cat->id}}">{{$cat->name}}</option>
@endforeach
</select>
</div>
<input type="text" name="subcat" id="subcat" class="form-control col-md-3 ml-5">
<button type="submit" class="btn btn-success btn-lg ml-3">Save Sub Category</button>
</div>
</form>
@endif
And here's my returned value.
{"_token":"XlzwIt2jFqcybqqSjwLLJIAChG5tui7gvHzlaeAq","subcat":"xx"}
Ad
Answer
You forgot to add name="cat" in select i guess
<select class="custom-select" id="inputGroupSelect01">
simple add name=""
attr
<select class="custom-select" id="inputGroupSelect01" name="cat">
Ad
source: stackoverflow.com
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS - Conditionally Load a Different Page
- → Make a Laravel collection into angular array (octobercms)
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
- → Validating fileupload(image Dimensions) in Backend Octobercms
- → OctoberCMS Fileupload completely destroys my backend
- → How do I call the value from another backed page form and use it on a component in OctoberCms
Ad