I need to submit a form with multiple values
<form onsubmit="return false;">
<?php
echo "<select id=\"uname\" name=\"uname[]\" multiple>\n";
$sql = "SELECT * FROM users ORDER BY surname ASC";
$res = $db->query($sql);
while($row = $res->fetch()){
$strA = $row["uname"];
$strB = $row["givenname"];
$strC = $row["surname"];
echo "<option value=\"$strA\">$strC, $strB</option>\n";
}
echo "</select>\n";
echo "<input type='button' name='endreBruker' value='OK' onclick='javascript:".$_POST['edit']."(this.form)'/>";
?>
and pass the POST values through this to newNote.php
function newNote(form) {
$('#main').load ('newNote.php', {'uname[]' : form.uname.value} );
}
Problem is I only receive an array with a single value.
Check out jQuery’s serialize(). You could then write something like this: