I want to know if there are any rules regarding using said before or after a name. For example, which of the following is correct?
"I am going to the bank," said John.
"I am going to the bank," John said.
Either form you gave is fine. Moreover, either of these forms can also be used in the middle of a quote, too:
"I am going to the bank," said John, "before it closes."
"I am going to the bank," John said, "to deposit some cash."
In writing, you probably want to avoid using the same form, in the same relative location, over an extended dialogue. That would get wearisome:
"I am going to the bank before it closes," said John.
"Maybe I should come with you," said Mark.
"Fine with me. There's plenty of room," said John.
"We'd better hurry. I think the bank closes in 15 minutes," said Mark.
"Well, then, let's not just stand here talking," said John.
Instead, something more like:
"I am going to the bank before it closes," said John.
"Maybe I should come with you," Mark replied.
"Fine with me. There's plenty of room."
You get the idea. (If I delve into it any more deeply than that, this'll get migrated to Writers.SE.)
It’s customary to use inversion only if the attribution follows the quote, not if it precedes it. So:
Terry Pratchett, one of the best dialogue writers today, in my opinion, uses "said Granny" rather than "Granny said" in his dialogues everywhere. At the same time though, it's always "she said" in his dialogues, not "said she." A simple tag, such as "said Granny" or "she said," is almost invisible to the reader, so it's OK to use it as needed. Eschew "replied John," or other more ornamental tags though, as these tend to work like potholes, disturbing the flow of the dialogue. Unlike "said" they are visible.