Re: Dropdown menus from DB query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



this is where smarty templating is so cool
using PEAR db

php code

$sql = 'select id, name from names order by name asc';
$smarty->assign('names',$db->getAssoc($sql));

template

<select name="name">
{html_options options=$names}
</select>


Cole Ashcraft wrote:
How would you create a drop down menu from a database query? I have
figured how to do it with one field, but how could it be done with a
system where the value is different than the displayed value (ie.
numerical code as the value, name displayed)?

Thanks,
Cole



-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux