When im input using checkbox for value windows 7 & 10 it doesn't get into the database.
But input in part <-- other -->, it can enter into database
Views Code :
<div class="form-group col-md-12">
<label>OS :</label>
<div class="checkbox-list">
<label class="form-group col-md-4">
<input id="os" name="os" type="radio" value="Windows 7">
<span></span>
Windows 7
</label>
<label class="form-group col-md-4">
<input id="os" name="os" type="radio" class="form-group" value="Windows 10">
<span></span>
Windows 10
</label>
<!-- other -->
<label>
<input id="other" name="" type="radio" class="form-group" value="Other :">
<label for="other" class="form-group">Other :</label>
<div class="other-disclosure">
<input type="text" name="os" id="os-other" class="form-group col-md-2" placeholder="Your OS ...">
</div>
</label>
<!-- other -->
</div>
</div>
Controller Code:
public function store(Request $request)
{
$folderPath = public_path('assets/signature/');
$image_parts = explode(";base64,", $request->signed);
$image_type_aux = explode("image/", $image_parts[0]);
$image_type = $image_type_aux[1];
$image_base64 = base64_decode($image_parts[1]);
$signature = uniqid() . '.'.$image_type;
$file = $folderPath . $signature;
file_put_contents($file, $image_base64);
auth()->user()->Form003()->create
([
'user_id' => $request->user_id,
'os' => $request->os,
'hardware' => implode(',', (array) $request->input('hardware', [])),
'software' => $request->software,
'signature' => $signature,
'status_desc' => $request->status_desc,
'cancel_deskripsi' => $request->cancel_deskripsi
]);
// dd($request->all())
// dd($form003);
return redirect()->route('form003')->with('status', 'Success');
}
even though they are one group
How to solve this problem ?
=========================================================================== its work, i change the input name
<label>
<!-- <input id="other" name="os" type="radio" class="form-group" value="Other :">
-->
<input id="other" name="os" type="radio" class="form-group" type="text">
<label for="other" class="form-group">Other :</label>
<div class="other-disclosure">
<input type="text" name="other" id="os-other" class="form-group col-md-2" placeholder="Isi OS Anda ...">
</div>
</label>
but input with "other" get new problem, the value that goes into the database always "on", not based on what i write the text.
the value "on" comes from where ?
Aucun commentaire:
Enregistrer un commentaire