Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.