[eluser]ajibolaabdullahi1[/eluser]
@ojcarga
tnx 4 ur reply, if i understand what you mean, i could also have used something similar to
Code:
<select name="role">
<option value="">select a role</option>
<? foreach ($roles as $role): ?>
<? ($role->id == $user->role) ? $selected='selected' : $selected='' ?>
<option value="<?= $role->id ?>" <?= $selected ?> > <?= $role->name?> </option>
<? endforeach; ?>
</select>
which would select the users role on initial load of the page, but how do i then handle repopulating the new selected value in case of an error after
Code:
$this->fom_validation->run()
Hence i'm trying to achieve two things, auto-select the users role in the DB on load of the page, and re-populate d selected value after the edit form is submitted in-case there's an error.
The one for text input boxes work as desired, but i'm having problem with that of the select drop-down
Code:
<label for="email">Email address:</label> <input type="text" name="email" value="<?= set_value('email', $user->email)?>" />