Ignoring child when they act out

My son hits his head the floor & falls out I always react to him.. his doctor told me to ignore him he’s trying to get attention.. but does that really work or make it worse? Any tips