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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 -


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux