additional field SELECT

Discussion in 'Templates customization' started by sitewizard, Mar 17, 2011.

  1. sitewizard

    sitewizard New Member

    Joined:
    Nov 29, 2010
    Messages:
    14
    Hi,

    how do I create the OPTION list for a SELECT statement for an additional field?
    i.e. my additional field is called "sector" and I want to display it so I was trying:

    <select id="f_sector" name="sector" size="1">
    {html_options options=$u.options.sector selected=$u.data.sector}
    </select>

    the variable $u.data.sector returns the VALUE (selected item) but I also need the list.

    I'm sure it can be done, but I can't find it! Any help much appreciated!
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Try this code:
    Code:
    {php}
    global $member_additional_fields;
    foreach($member_additional_fields as $f){
    if($f['name'] = 'sector'){
    $this->_tpl_vars['sector_options'] = $f[options]; break; 
    }
    }
    {/php}
    <select id="f_sector" name="sector" size="1">
    {html_options options=$sector_options selected=$u.data.sector}
    </select>
    
    

Share This Page