Your array $a is declared as being empty which is why it takes the first value at your index 0.
If you add a value, say
$a = [12];
and then run your code, notice that 12 is now at index 0 and weight follows the next then at index 1.
You can also run a test on adding another variable, say $b -
$a = [];
$b = 18;
if (isset($_POST['submit'])) {
$weight = $_POST['weight'];
array_push($a, $b, $weight);
}
print_r($a);
Your print will return
Array {[0] = 18 [1] = 10 (or whatever value was passed for $weight}