a little html_options problem
| From: | Willy Mularto | Date: | Tue, 22 Mar 2005 12:46:45 +0000 |
| Subject: | a little html_options problem | ||
| References: | 1 2 3 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-12353@lists.php.net to get a copy of this message | ||
Hi,
I have a little problem about html_options, below is the code I use:
php side:
<?php
..
$query_category = "SELECT * FROM categories";
$resultcats = $conn->Execute($query_category);
while(!$resultcats->EOF)
{
$category_id[] = $resultcats->fields[category_id];
$category_name[] = $resultcats->fields[name];
$resultcats->MoveNext();
}
$smarty->assign("category_name",$category_name);
$smarty->assign("category_id",$category_id);
..
?>
template side:
{html_options values=$category_id output=$category_name}
result side:
<option value="0">Select Category ID</option>
<option label="main cateogory #1" value="1">main cateogory #1</option><-- watch this
<option label="main cateogory #2" value="1">main cateogory #2</option> <--watch this
<option label="'Ini tes' yang "ini" juga" value="2">test</option>
<option label="sub main category#1" value="3">test</option>
<option label="sub test" value="4">sub test</option>
<option label="" value="5"></option><-- watch this
As you see something wierd happened here, see the first, second and last options. the first and the last return the same value "1" and the last is empty "". If I try just to echo it, everything is fine. But when I implement the html_options it happened. What missed here? Thankyou for any reply..
Regards
Willy