Reputation: 51
Hay everyone need a bit of help Because i'm new to coding.
I've created a column in my movies table called quality and i want to creating a smarty select option list that would contain 3 options.
DVD
TS
CAM
So how would i create a smartys select option list and how would i assign the 3 options to the option list.
Here is a example of 1 of my option list looks like.
<select name="languages[<?php print($counter); ?>]" id="languages_<?php print($counter); ?>">
<?php
foreach($language_options as $lang_key => $code){
print("<option value\"{$code}\"");
if (isset($languages[$key]) && $languages[$key]==$code) print(" selected=\"selected\"");
print(">{$code}</option>\n");
}
?>
</select>
Please help.
Thanks
Upvotes: 0
Views: 4472
Reputation: 8642
Smarty has a neat little feature for it called html_options
(docs). Basically it's used like this:
{html_options name=yournameforit options=$language_options selected=$code)}
In your example you're writing in phtml, which got me confused as Smarty has it's own syntax (imho, a lot prettier than phtml). I hope that helps.
Upvotes: 2