2 Replies Latest reply on Sep 29, 2010 4:43 AM by Rajeshwar Gaini

    How to pass array as comma separated values in POST method?

    Rajeshwar Gaini

      Hi Friends,

       

      I have an array of document numbers (thousands of document numbers). I want to pass this array to php using POST method in flex.

       

      For example:

       

           <mx:HttpService id="getdocs" method="post",......../>

       

           var doc_nums:Array = {1,2,3,4,......1000};

           var doc_nums_obj:Object = new Object();

           doc_nums_obj.doc_nums = doc_nums;

           gedocs.send(doc_nums_obj);

       

      If i use the above code, it will pass the arguments as

                doc_nums=1&doc_nums=2&doc_nums=3&.....&doc_nums=1000

       

      So, if i use doc_nums = $_POST['doc_nums'] in the PHP code of backend, i will get only the last doc number i.e 1000 as the value.

       

      Is there a way to get this array of doc numbers as comma separated values (i.e doc_nums = 1,2,3,4,5,6....1000) in the argument of POST method.

       

      Of course, i can prepare a string of comma separated doc numbers from this array and send using POST method. But, i am just curious if POST method can do this automatically. For example, if i send the same array using GET method, it will send them as comma separated values. But, unfortunately if the number of doc numbers exceeds a certain limit it will not send anything.

       

      Any idea how to do this?