HTML multiple options trouble
| From: | Marcus Bointon | Date: | Thu, 25 Nov 2004 22:18:24 +0000 |
| Subject: | HTML multiple options trouble | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-12000@lists.php.net to get a copy of this message | ||
I'm using html_options to generate an HTML select multiple selection box, and I've added multiple="multiple", so it's looking right, but I noticed that it does not produce the expected results
My Smarty source is (referring to some appropriate object properties):
{html_options name="propvalue[$custompropid]" values=$customprop->valuerange output=$customprop->valuerange selected=$customprop->value multiple="multiple"}
and this renders to (for example):
<select name="propvalue[45]" multiple="multiple">
<option label="Mars" value="Mars">Mars</option>
<option label="Twix" value="Twix">Twix</option>
<option label="Snickers" value="Snickers">Snickers</option>
</select>
which correctly appears as a multiple selection box, but if I select more than one item in it, all I receive is a single string containing the last selected item, e.g. if I select mars and twix, I'll get this in $_POST:
array(1) {
["propvalue"]=>
array(1) {
[45]=>
string(4) "Twix"
}
}
why on earth isn't $propvalue[45] an array???
I have an almost identical setup using html_checkboxes that's working fine.
If anything, this looks like a browser problem (I'm running in Safari) as the generated code looks correct - I just can't think of why this might be happening - any ideas?
Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
marcus@synchromedia.co.uk | http://www.synchromedia.co.uk