Basic html_options question
| From: | Luc Saint-Elie | Date: | Mon, 07 Apr 2003 12:41:34 +0000 |
| Subject: | Basic html_options question | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-9158@lists.php.net to get a copy of this message | ||
Hello,
For the following array named $texte:
Array (5)
0 => Array (2)
id => 1
titre => title one
1 => Array (2)
id => 2
titre => title 2
2 => Array (2)
id => 3
titre => title 3
3 => Array (2)
id => 4
titre => title 4
4 => Array (2)
id => 5
titre => title 5
How can I get the following select
<select name="myform">
<option value=id>titre</option>
</select>
Concretely :
<select name="myform">
<option value="1">title1</option>
<option value="2">title2</option>
<option value="3">title3</option>
<option value="4">title 4</option>
<option value="5">title 5</option>
</select>
If i do :
{html_options options=$texte}
I get a very sophisticated :
<select name="myform">
<optgroup label="0">
<option label="title 1" value="1">title 1</option>
</optgroup>
<optgroup label="1">
<option label="title 2" value="2">title 1</option>
</optgroup>
[...]
</select>Thanks in advance Luc