Intention
Question :

If one fasted and did not know the rules of fasting and omitted the intention, are his fasts valid?

Answer :

One can consider the fasting to have been valid if he doubts the validity now and there is a probability that it might be valid. In any case, the intention of fasting is not difficult to accomplish, and is usually present from everyone who is fasting, since one has the intention of fasting in mind during his fast.