It is usually hard to decide when to use Por or Para in Spanish. This is because in English you would use just For in both cases.
POR has a meaning of passage, exchange and duration. It is the way of an action.
Thanks for your help = Gracias por tu ayuda
I work for 8 hours = Trabajo por 8 horas
PARA has a meaning of purpose. It is the other end of an action
The cake is for Maria = La tarta es para Maria
Estoy preparando mi clase para mañana = I am preparing my class for tomorrow