Re: Is there a way to get multiple values for a singleinput in a form submission?

From: Date: Thu, 23 Mar 2006 19:24:46 +0000
Subject: Re: Is there a way to get multiple values for a singleinput in a form submission?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-232470@lists.php.net to get a copy of this message
Hi Mark, Actually you can access this variable within Javascript in the following manner: function chgablacted() { box = regs['myselect[]']; value = box.options[box.selectedIndex].value; if (value == 'some value') { ... } else { ... } } The name of the variable will include the brackets []. sunil. mslemko wrote:
Thanks Warren, This works! The side effect that is -somewhat- undesirable is that it becomes incompatible accessing the field with Javascript. Perhaps there is a way to get around that problem though. -Mark Warren Vail wrote:
Set the name of your field in html to be; name="myselect[]" that way when the form is returned to you each selected value is returned to you, for example if you code $choices = $_POST["myselect"]; choices will be an array containing the actual values selected when the form is submitted. hope this is what you were looking for. Warren Vail
- clip -


« previous php.general (#232470) next »