Reputation: 1099
I have created a php table like so:
echo "<table border = '0' cellpadding ='10'>";
echo "<tr>
<td> Question <td>Mark</td><td>Criteria</td>
<td>Feedback</td>
</tr>";
while ($row = mysql_fetch_array($result))
{
$question[]=$rows['question'];
echo "<tr>";
echo "<td>". $row['question']. "</td>";
echo "<td>" ."<input type = 'text' name = 'mark[]' size = '1' value = '0' id = 'mark'/>/". $row['maxMark'] . "</td>";
$maxMark[] = $row['maxMark'];
echo "<td>".$row['criteria']."</td>";
echo "<td>" . "<input name = 'feedback".$counter."' id= 'feedback' value='Enter feedback'>". "</td>";
echo "</tr>";
$counter++;
}
echo "</table>";
echo "</tr>\n";
echo "</table>";
I want to get the all the data i input from mark and put it into an array and then post it to another page and update my database. The only thing i am having trouble with is getting the values i input and putting them all in an array
any help would be appreciated :)
Upvotes: 0
Views: 1852
Reputation: 13765
Use the form array notation ...
echo '<input type="text" name="data[mark]', $counter ,']" />';
echo '<input type="text" name="data[feedback][', $counter ,']" />';
then everything will be array
$data = $_POST['data'];
p.s. you should use double-quotes for html tag attributes and echo with ',' rather than '.'
Upvotes: 1