-1

I want to perform same as bellow in my android project how can i do it?

Html:

<html>
<body>
        <form action="npost" method="post">
        <input type="checkbox" name="n1[]" value="1">
        <input type="checkbox" name="n1[]" value="2">
        <input type="checkbox" name="n1[]" value="3">
        </form>
</body>
</html>

Php:

$s1 = $_POST["n1"]; 
6
  • Can you not just change params.put("s1" to params.put("s1[]"? Commented Mar 9, 2018 at 12:01
  • no "s1[]" not working it will return single data to because it is Map<String,String> Commented Mar 9, 2018 at 12:03
  • s1 ???? Use "n1[0]" , "n1[1]" and "n1[2]". Commented Mar 9, 2018 at 12:04
  • it will not entertain if u have large data and also automated data to be written to server Commented Mar 9, 2018 at 12:07
  • Of course it can work then to. Just make a loop. Very simple. Commented Mar 9, 2018 at 12:10

1 Answer 1

0

My personal approach to this problem: First, convert the array to a json ( Follow This )

After that, send the json as a normal string to your php, then use json_decode($yourstring) to convert the string to a json file.

Read the json file out and loop through it to store as an Array.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.