Greebo is right on. There is no option to save your house without paying for it. Many people don't know that.
Chapter 7 is Liquidation
Chapter 13 is Reorganization
Chapter 7 requires a means test to qualitfy for or get bumped to 13. Your qualifed assets are liquidated. There is no repayment plan. A trustee gathers your qualified assets and liquidates them to pay as much as you can to your creditors. The house debt is not included, and is one of the debts that you will not get discharged. So while you may postpone foreclosure, you will still need to bring the loan current to keep the house. Chapter 7 does not extinguish debt on property (secured debt).
See:
http://www.uscourts.gov/bankruptcycourts/bankruptcybasics/chapter7.html
Chapter 13, gives people with regular income a chance to come up with a payment plan to pay all or some of their debts. A payment plan lasts about 3-5 years. Your mortgage will be part of the plan. Usually the valid notice of default (notice to foreclose) is still valid if you miss the payment under the plan for your mortgage. This means, you miss one payment under the plan on your mortgage, and they can pick up on the foreclosure process right where they left off.
See:
http://www.uscourts.gov/bankruptcycourts/bankruptcybasics/chapter13.html
Both postpone foreclosure. Chapter 7 during what is called a "stay" and chapter 13 until the payment plan is worked out, and then it's up to you to make the payment plan payments on time to keep the house.
The hope in chapter 7 is that you get enough unsecured debts discharged that you can have a fresh start that allows you to have enough money to make the mortgage payments.
There is no magic to discharge mortgage debt. You hear congress talk about giving judges "cramdown" authority to re-write mortgage contracts and write off principal, but it has not happened and woould cause mortgage interest rates to probably double, since the creditors would need to price in additional losses from bankruptcy judges. Under chapter 7 your unsecured debts can be discharged or written down. Under chapter 13, unsecured debt amounts can be negotiated for the payment plan.
The only way people are getting write downs on principal is through the short sale method. They are still tough to get, and they are only granted in some cases because the borrower is agreeing to move out and lose title to the property. In many cases, investors and mortgage insurance companies will only write off principal in a short sale if the borrower agrees to a promissory note to pay them back for some part of the writeoff amount. Those promissory notes are unsecured debt.
In theory, you could do a short sale, have the investor or pmi company get you to sign a promissory note for all or some of the amount they are writing off. That amount becomes unsecured, and then you could file chapter 7 or 13. It is very difficult to get chapter 7 and discharge unsecured debts. You have to have someone search and look through your assets and liquidate them, if you have any. You have to pass a tough means test. I am sure there are people who qualify, but they are truly broke (no assets) and need to start over. Congress made Chapter 7 much harder to get a few years ago. If you get caught hiding assets you are in deep stuff!
I'm not a lawyer, just someone who has researched these avenues. I suggest anyone considering bankruptcy talk to a good lawer. Anyone considering a short sale find an experienced realtor and even consult a real-estate attorney. Laws vary by state.