Jump to content

Selected Value in Dropdown - Smarty


anujgarg

Recommended Posts

Hi Everyone,

 

I am stuck with a problem. I am using smarty for my application. I am trying to display a value fetched from database to be selected in the dropdown. The good thing is I am able to display the value on webpage (outside of dropdown) and the bad thing is that I am not able to get selected the value in dropdown.

 

Lets take a descriptive look at my problem: I have a dropdown (see the snapshot). I am able to display the second value "registered" on webpage outside of dropdown but when I try to integrate it in dropdown it does not show me that value as selected.

 

I am using following code for it:

<select name="public_private">

          <option value="public" selected>{$smarty.const._HWDVIDS_SELECT_PUBLIC}</option>

          <option value="registered">{$smarty.const._HWDVIDS_SELECT_REG}</option>

</select>

 

And I need to use it as:

{foreach name=outer item=data from=$grp_memberlist}

{$data->access}

{/foreach}

 

I am able to display the "registered" value on webpage by {$data->access}. But how to integrate it in dropdown.

 

Please suggest...

 

Thanks

Anuj

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/194014-selected-value-in-dropdown-smarty/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.