• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
no output display in dropdown list

#7
Here's an even more fun way to do it. People often forget that echo will output a comma-separated list of arguments.

I put each argument on a separate line in this example just to illustrate the technique. It would not have to be done that way and might make more sense (be easier to understand) if formatted differently.

PHP Code:
<select name="staff" id="staff" required>
    <
option value="">Select Staff</option>
    <?
php while ($row_subject mysql_fetch_array($query_subject))
    {
        echo 
"<option value='",
        
$row_subject['deo_code'],
        
"'",
        
$this->input->post('staff') == $row_subject['deo_code'] ? ' selected' NULL,
        
$row_subject['deo_code'],
        
"-",
        
$row_subject['deo_name'],
        
"</option>";
     }
?>
</select> 
Reply


Messages In This Thread
no output display in dropdown list - by kvanaraj - 10-11-2018, 04:35 AM
RE: no output display in dropdown list - by Piotr - 10-11-2018, 08:20 AM
RE: no output display in dropdown list - by Piotr - 10-11-2018, 11:40 AM
RE: no output display in dropdown list - by dave friend - 10-11-2018, 12:09 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2018 MyBB Group.