Your question started "David was heading for the goalposts..."
Now you mention a ball. So what do you mean? That David "headed" the ball towards goal? Because "David was heading for the goalposts" just means he was going there.
Sorry if I misunderstood.