Reputation: 47
I have a form like this
<input type = "text" name="name[]" value="1"> //row1
<input type = "text" name="name[]" value="2"> //row2
<input type = "text" name="name[]" value="3"> // row3
When I process the form in PHP, I get duplicate values in $_POST['name'] array.
print_r($_POST['name']);
Array ( [0] => 1 [1] => 2 [2] => 2 [3] => 3 [4] => 3 [5] => 3
Row 1 time
Row 2 posting 2 times
Row 3 posting 3 times
Please help.
Edit:: Here is the complete code http://pastebin.com/mYey5qcH
I am trying to print line 113. The field prqty[] is behaving as I mentioned in above example.
Solution: I have fixed it myself, the issue was the append statement. I used
tr.appendTo('#table_dest10');
instead of
('#table_dest10').append(tr);
Upvotes: 1
Views: 143
Reputation: 47
I have fixed it myself, the issue was the append statement. I used
tr.appendTo('#table_dest10');
instead of
('#table_dest10').append(tr);
Upvotes: 0
Reputation: 2509
<input type="name[]" value="1"> //row1
<input type="name[]" value="2"> //row2
<input type="name[]" value="3"> // row3
this is wrong i think you are looking for this
<input type="text" name="name[]" value="1"> //row1
<input type="text" name="name[]" value="2"> //row2
<input type="text" name="name[]" value="3"> // row3
Upvotes: 2
Reputation: 119
I think you forgot to define input type. Make it text then try again
Upvotes: -1