In England, "How do you do?" was until recently a commonplace greeting. The correct response was, "How do you do?" This may be what you're thinking of.
Both "How are you?" and "How are you doing?" should generally be taken as a question, to which the reply is often, "Fine, thanks!" or, more formally, "Very well, thank you." However, the whole thing continues to confuse even English people, let alone visitors.
How do you do?
This is not a question. It is another, very formal way of saying "Hello." It is also very British.
The correct response is; "Pleased to meet you." or "How do you do." or just "Hello."
We only really use it the first time we meet someone.
How are you?
This is a question, but the person asking it doesn't really want to know the truth about your aching back or hangover.
A polite response is; "I'm fine thanks. And you?"