From Baen’s Bar:

On the use of quotations: Every stylebook I have checked agrees. The form should be:
“Is he ill?” she asked.
The question mark goes within the quotation marks and the “s” in “she” is lowercase. It is one sentence, not two.
In all styles I checked, the comma goes inside the quotation marks unless the matter inside those marks is a single word used as a term. Thus the sentence:
He called it a “term”, but I disagree.
is correct. But it is correct only in one style, APA, which is an ugly style anyway. Chicago allows it with the use of single quotation marks surrounding a term, though it recommends using italics; and everyone else says to put the comma inside the quotation marks.
The general rule is that commas and periods go inside the quotation marks and other punctuation goes inside _only_ if it refers to the matter within the quote. Thus you might get:
Did she say, “He is sick”?
Please remember when you are arguing over grammar that it is a very fluid thing. The grammar that was considered standard
in the mid-1800s is considered outrageous today. That is how it should be, since English is still being used by living people. And much of what we call grammar is really a matter of style, which is whatever editors decide it is.
Much of what you learned about grammar in elementary and high school is folklore. Almost every grammarian spends at least a page laughing over the silly rules your teachers gave you.
So when you argue over grammar, try to remember that there are very few, if any, hard rules. There are, however, quite a few “nonrules” that seem to generate a lot of heat. Most important, remember that the only reason for grammar is to
make it easier for the reader to understand what you mean. So if you have to break a rule, break it. Heck, I doubt that most of us are any good with rules in the rest of our lives. It seems silly to
become upset with them here.
For those who are looking for easy grammar books, I recommend two that have helped me: Bernstein’s The Careful Writer and the AP Stylebook. They are easy to use and also fun to read.