I wasn't sure how to title my question, I'm basically asking if anyone knows a better way to approach this. I'm using this function below to show which option is pulled from the DB, I'm wondering if there is a more compact way or better way to do this other than elseif each ID
function access_option($access)
{
if ($access == 0)
{
echo '<option value="0" selected>Member</option>
<option value="1">Streamer</option>
<option value="2">Moderator</option>
<option value="3">Manager</option>
<option value="4">Administrator</option>
<option value="5">Senior Administrator</option>';
}
elseif ($access == 1)
{
echo '<option value="0">Member</option>
<option value="1" selected>Streamer</option>
<option value="2">Moderator</option>
<option value="3">Manager</option>
<option value="4">Administrator</option>
<option value="5">Senior Administrator</option>';
}
elseif ($access == 2)
{
echo '<option value="0">Member</option>
<option value="1">Streamer</option>
<option value="2" selected>Moderator</option>
<option value="3">Manager</option>
<option value="4">Administrator</option>
<option value="5">Senior Administrator</option>';
}
elseif ($access == 3)
{
echo '<option value="0">Member</option>
<option value="1">Streamer</option>
<option value="2">Moderator</option>
<option value="3" selected>Manager</option>
<option value="4">Administrator</option>
<option value="5">Senior Administrator</option>';
}
elseif ($access == 4)
{
echo '<option value="0">Member</option>
<option value="1">Streamer</option>
<option value="2">Moderator</option>
<option value="3">Manager</option>
<option value="4" selected>Administrator</option>
<option value="5">Senior Administrator</option>';
}
elseif ($access == 5)
{
echo '<option value="0">Member</option>
<option value="1">Streamer</option>
<option value="2">Moderator</option>
<option value="3">Manager</option>
<option value="4">Administrator</option>
<option value="5" selected>Senior Administrator</option>';
}
}
Is this the best way to do it?