Re: [SMARTY] html_options questions

From: Date: Wed, 23 Apr 2003 20:55:01 +0000
Subject: Re: [SMARTY] html_options questions
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-9365@lists.php.net to get a copy of this message
I have recent write that line: {html_options options=$data name="effort"} But don't create for my the <select></select> Tag's. The question... Why ? Thx. <ef> "Messju Mohr" <messju@lammfellpuschen.de> escribió en el mensaje news:20030417231108.GC30082@pharao.lammfellpuschen.de... > On Thu, Apr 17, 2003 at 03:55:45PM -0700, Ryan Allen wrote: > > > > 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; > > 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. > > > } > > $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> > > remove the "<select>" and "</select>" (it is done by > html_options for you) and do > {html_options options=$data name="effort"} > > HTH > messju > > > 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 > > > > > > > > -- > > Smarty General Mailing List (http://smarty.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.smarty.general (#9365) next »