hello, i’m trying to populate a view file to edit user’s profile.
<select name="role">
<option value="">select a role</option>
<? foreach ($roles as $role): ?>
<? ($role->id == $user->role) ? $default=TRUE : $default=FALSE; ?>
<option value="<?= $role->id ?>" <?= set_select('role', $role->id, $default) ?> > <?= $role->name?> </option>
<? endforeach; ?>
</select>
the problem is that no default value is selected, what’s the solution.
