i want to make my edit is auto select option but when i try is doesnt work. i need my form edit is auto select the data if i click data with id_cms_companies "1" from my table location is auto select and show in the first select option. and its show the name of table cms_companies here my code :
<select class='form-control' name='id_cms_companies'>
<option>- Companies -</option>
<?php
$category = DB::table("cms_companies")->get();
foreach($category as $cat)
{
if($cat->name == $row->id_cms_companies)
{
echo "<option value='$cat->name' selected>$cat->name</option>";
}
else
{
echo "<option value='$cat->name'>$cat->name</option>";
}
}
?>
</select>
here my table :
and here for my
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire