RE: [SMARTY] html_options questions
| From: | Ryan Allen | Date: | Thu, 17 Apr 2003 23:16:52 +0000 |
| Subject: | RE: [SMARTY] html_options questions | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-9310@lists.php.net to get a copy of this message | ||
Yes, this is the answer. Thank you. I was not thinking very clearly
about that. You have to create your own array, with the id as the
index.
This works great!
-- Ryan
> while ($row= mysql_fetch_object($result)) {
> $data[]=$row;
i think you should do
$data[$row->id] = $row->title;
instead.
this makes $data an associative-array mapping the value of the options
to the title that is to be printed. what you constructed was an array
of objects.
remove the "<select>" and "</select>" (it is done by html_options
for
you) and do
{html_options options=$data name="effort"}
HTH
messju