Re: [SMARTY] ... just beginning

From: Date: Thu, 11 Apr 2002 18:21:01 +0000
Subject: Re: [SMARTY] ... just beginning
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-3641@lists.php.net to get a copy of this message
Blue Presley wrote:
i'm new at smarty, and even though the manual is 112 pages long, it's terribly non-informative from a "how to" point of view.. so hopefully you guys can help. I am retreiving results from mysql and using a while loop to assign the values to an array. The following is the code: $sql = "select catId, category from categories"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) { $catId = $row["catId"]; $category = $row["category"];
              }
I am using these results in a select box in my html form. I assume I will use HTML_OPTIONS to accomplish this. My question is, how do I assign values that smarty will understand and therefore give me the desired options list in my html form? thanks for ur help blue
According to the manual ;-) You can do it two ways. Assign two arrays to the template, and use these for the values and output attributes: {html_options values=$opt_vals output=$opt_output} Or, you can pass an associative array which covers both: {html_options options=$options} You can optionally pass a selected attribute to determine the currently selected element. You need anything more specific than that? Monte -- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.

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