Welcome Guest, Not a member yet? Register   Sign In
no output display in dropdown list
#7

(This post was last modified: 10-11-2018, 11:10 AM by dave friend.)

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, 03:35 AM
RE: no output display in dropdown list - by Piotr - 10-11-2018, 07:20 AM
RE: no output display in dropdown list - by Piotr - 10-11-2018, 10:40 AM
RE: no output display in dropdown list - by dave friend - 10-11-2018, 11:09 AM



Theme © iAndrew 2016 - Forum software by © MyBB