html_options questions
| From: | Ryan Allen | Date: | Thu, 17 Apr 2003 22:55:45 +0000 |
| Subject: | html_options questions | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-9308@lists.php.net to get a copy of this message | ||
Hi, I'm very confused how html_options works.
I'm getting a bunch of rows from a database. I'm trying to put one
field as the name of the drop down entry and another field as the id.
All I can get the drop down box to say is:
Option
Option
Option
Option
Option
Option
Here is my code:
index.php:
while ($row= mysql_fetch_object($result)) {
$data[]=$row;
}
$sm->assign('data', $data);
index.tpl:
<p><font size="5">Select test effort:</font></p>
<select name=effort>
{html_options options=$data name=$data->title }
</select>
The mySQL table has three fields:
| id | title | versionID |
It's got 6 rows of data, and I'm getting 6 "Options" in the drop down
box, so I know we are getting the data. How can I display the title and
not "Option"??? The documentation is not that clear, and does it a
different way. Thanks!
-- Ryan
Ryan Allen
Senior Test Engineer
F5 NETWORKS
email: r.allen@f5.com