Для takes genitive. За, when it means "for", takes accusative. There is a difference in the meaning of the words, English "for" covers both but Russian uses two words. I can attempt to explain, but I'm a learner, too, and don't always get it right.
Для is used with the target or recipient of something. Эта книга для тебя = this book is for you. It may also establish a personal view or relation: Для меня это не важно = for me that is not important. Furthermore it establishes the purpose of something: этот прибор для того, чтобы... = this device is (meant) for... All these meanings seem to imply some kind of flow or direction, if purpose can be said to have a direction.
За establishes a different kind of connection, more like a handle on something: прости меня за то, что... = forgive me for the fact, that... In this case, "for" acts more like a handle on that which it refers to (for the fact), nothing is changing hands. In платить за билет = pay for the ticket money does change hands, but the money is для подавца билета (for the ticket seller) as recipient, and за билет as the thing which is being paid for.
За may also take instrumental case and can sometimes be translated by "for": идтй в магазин за хлебом = go to the shop for bread, послать за доктором = send for the doctor, in both cases it means "to obtain" (the bread, the doctor).