hello guys I would like to set my option selected on my controller using foreach in html tag
this is my controller :
$category = Subcategory::where('category_code', $request->category_code)->get();
$selected = 'selected';
foreach ($category as $item) {
$html .= '<option value="'.$city->code.'" '.if($request->subcategory_code==$city->code) { echo $selected; }.' >'.$city->name.'</option>';
}
Aucun commentaire:
Enregistrer un commentaire