So che questo è un po 'tardi, ma qui è un altro modo :)
// var psn_ = myForm.elements['array_name[]']; // --> getting array by name
var myValues = new Array();
if(myValues.length == undefined) { // if length is 1, length becomes undefined
myValues = [].concat(myValues); // make 'myValues' an array
var tempVar = myValues[0].value; // get and store value
}
else{
var tempVar = ""; // temporary variable to store all values of array
for (var i = 0; i < myValues.length; i++) {
tempVar += myValues[i].value; // example ["one", "two"]
tempVar += ','; // tempVar = one,two,
}
tempVar = tempVar.substring(',', tempVar.length - 1); // tempVar = one,two
}
Passando ad un altro file
... "url_name.php?tempVar=" + tempVar + ... // passing through URL
Prendi il valori in PHP tramite
$getValue = $_GET['tempVar']; // get value from tempVar in URL
$getValue_Array = explode(',', $getValue); // getValue_Array[0] = "one"
// getValue_Array[1] = "two"
Perché ... tramite PHP? – KarolDepka
È inoltre possibile utilizzare jQuery. – Stophface
Questa è una risposta molto pesante per un accessorio di array. Sta facendo molto di più che dice sulla latta, e considerando il pubblico della domanda originale, probabilmente farà più male che bene. –