I have a list box where users can Add, Delete and Update and Save the list. Once clicked on the Save button I am doing a call to the jquery to build the array of elements in the list box and then doing a POST using a hidden INPUT elememt. But I am getting an empty array the PHP POST. Here is the jquery
$("#saveCategory").click (function() {
var items = $("#jqxlistbox").jqxListBox('getItems');
var length = items.length;
var mylist = new Array();
for (var i = 0; i < length; i++) {
var row = {};
row["cname"] = items[i].value;
row["cvalue"] = items[i].label;
mylist[i] = row;
}
$("#myCatgories").value(mylist);
});
here is my html form
<form id="addcategory" method="post" action="index.php">
<div style="float: left">
<input type="button" value="Add" id="addCategory" style="margin-left: 3px" />
<input type="button" value="Update" id="updateCategory" style="margin-left: 3px" />
<input type="button" value="Delete" id="deleteCategory" style="margin-left: 3px" />
<br />
<input type="submit" value="Save" id="saveCategory" style="margin-left: 3px" />
</div>
<div>
<input type="hidden" name="myCatgories[]" id="myCatgories" value="">
</div>
Can someone please tell me what I am doing wrong here and put in the right the direction.
Thanks