That's not really how you want to do it.
There is no reason to have any sort of counter, and you aren't doing the HTML elements correctly.
Don't define the index in the fields, you could just do this and they will be automatically defined:
<input type="text" name="data[]"><br/>
<input type="text" name="data[]"><br/>
<input type="text" name="data[]"><br/>
<input type="text" name="data[]"><br/>
Then, you're PHP logic is off. Just count the elements in the $data array in the POST array. Like so:
<?php
$num_fields = count($_POST['data']);
for ($i = 0; $i < $num_fields; $i++)
{
echo $_POST['data'][$i] . '<br/>';
}
?>
This will get you started, but if you're actually using this code in a production environment you need to do things like error checking and making sure $_POST['data'] is actually an array (is_array).