Re: [SMARTY] HTML multiple options trouble

From: Date: Thu, 25 Nov 2004 22:36:30 +0000
Subject: Re: [SMARTY] HTML multiple options trouble
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-12001@lists.php.net to get a copy of this message
what happens when you name the select?... propvalue[45][] Marcus Bointon wrote:
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


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