Selecting Users with Option Tag

Status
Not open for further replies.

Detox

Member
Jul 24, 2010
365
24
Hey Y'all,

It's been awhile since I posted here, I'm starting to get back into Retro world again. I'm trying to create myself a little report tool with RevCMS I'm trying to use the option tag and selecting users with rank 3 or higher.

this is what I have so far

PHP:
<!DOCTYPE html>
<html lang="en">
<?php
$getStaff = mysql_query("SELECT `username` FROM `users` WHERE `rank` >= '3'");
 while($staffUser = mysql_fetch_array($getStaff)){
     echo '
     <select name="report_staff" class="form-control">
    <option value="NA">N\A</option>
    <option disabled>-------------------------</option>
     <tr>
     <a href="{url}/home/'.$staffUser['username'].'">
     </tr>'
 }
 ?>

But it just breaks my test page basically making it all white
 

JayC

Always Learning
Aug 8, 2013
5,493
1,398
Well you're code is fucked I don't understand what you're putting the select in the while loop for? that creates a new select everytime.

Here:

Code:
<select name="report_staff" class="form-control">
 <option value="NA">N\A</option>
 <option disabled>-------------------------</option>
<?php
     $getStaff = mysql_query("SELECT `username` FROM `Users` WHERE `Rank` >= '3' LIMIT 15"); 
     while($staff = mysql_fetch_array($getStaff)){
                  echo '<option value="'. $staff['username'] .'">'. $staff['username'] .'</option>
      }
?>
</select>
 

Detox

Member
Jul 24, 2010
365
24
Well you're code is fucked I don't understand what you're putting the select in the while loop for? that creates a new select everytime.

Here:

Code:
<select name="report_staff" class="form-control">
 <option value="NA">N\A</option>
 <option disabled>-------------------------</option>
<?php
     $getStaff = mysql_query("SELECT `username` FROM `Users` WHERE `Rank` >= '3' LIMIT 15");
     while($staff = mysql_fetch_array($getStaff)){
                  echo '<option value="'. $staff['username'] .'">'. $staff['username'] .'</option>
      }
?>
</select>
Actually I fixed it. We can close this thread now :)
 

JayC

Always Learning
Aug 8, 2013
5,493
1,398
post your solution if different from mine to help people who may have the same issue with their php select statement so they can get an idea of how to fix it.
 

Detox

Member
Jul 24, 2010
365
24
post your solution if different from mine to help people who may have the same issue with their php select statement so they can get an idea of how to fix it.
PHP:
<select name="report_staff" class="form-control">
<?php
$getStaff = mysql_query("SELECT username FROM users WHERE rank >= '3'");
 while($staffUser = mysql_fetch_array($getStaff)){
    echo'
    <option value="NA">N\A</option>
    <option disabled>-------------------------</option>
    <option value="">'.$staffUser['username'].'</option>';
}
?>
</select>
Image:
2cfwb8.png
 
Status
Not open for further replies.

Users who are viewing this thread

Top