This paper discusses the model for a perishable product with two types of states, a good state and a bad one. The commodities sell well when the good state occurs at the beginning of a period, but do not when the bad state occurs. An indicator random variable is defined to express the states, and it is a Bernoulli random variable with unknown parameter which has a conjugate beta prior. We express the maximum expected profit for remaining periods by a dynamic program and obtain the optimal ordering policy in the first period. As a main result, we get a relationship between the numbers of times at which the good and the bad state occurred and the expected profit for remaining periods. Moreover, numerical examples are given to illustrate an optimal ordering policy for remaining $n>1$ periods.