I have a html table with check box on every row and when I click the checkboxes at a specific row, i am supposed to echo the input text using php. However, I can only get the input text for the first row. All the other rows give me a blank data. I dont understand whats wrong with my code
<?php
if(isset($_POST['submit']))
{
foreach($_POST['test'] as $key=>$value)
{
echo $_POST['tCode'][$key];
}
}
?>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div style="width:48%; margin-left:440px">
<table border="0px" align="center" class = "table" style="margin-right:530px;">
<form name="MainForm" method="post" action="" >
<tr>
<th style = "float:right">Tracking code:</th>
<th>
<td> <input type="textbox" name="tCode[]" id="1" ></td>
<td> <input type="checkbox" name="test[]" id="name" value ="1" />
</td>
</th>
</tr>
<tr>
<th style = "float:right" >Order Code: </th>
<th>
<td> <input type="textbox" name="tCode[]" id="2" ></td>
<td> <input type="checkbox" name="test[]" id="name" value ="2" />
</td>
</th>
<th>
</tr>
<tr>
<th style = "float:right" >product Code: </th>
<th>
<td> <input type="textbox" name="tCode[]" id="3" >
</td>
<td> <input type="checkbox" name="test[]" id="name1" value ="3"/></td>
</th>
<th>
</tr>
<td></td>
<td><input class="btn" type="submit" value="Submit" name = "submit" style="margin-left:50px" /></td>
When i tick the first checkbox, and type hello world in the first texbox, click submit, it is able to echo out "hello world", whereas for the other checkboxes, the inputted text is blank despite the textbox having value in it.