Teaching children how to use the toilet regularly is a process that takes time, patience and understanding. Parents can become easily frustrated when a child who seemed to be making progress "relapses," and continues to need "pull ups" or diapers. If the child is sensitive to a parent's frustration, the child could react in several different ways: they could lose self-esteem and confidence, develop anxiety concerning their "failures" and accidents.
The important thing that parents need to remember is that for the child there are two issues the child is struggling with internally during this period. First, the child needs to learn how to use the toilet. That process includes recognizing the warning signals of the need to use the toilet (the feeling of a full bladder), using one's will power to "hold it in," getting to a toilet in time, and finally, relaxing the muscles and letting the waste matter out of the body. The second part of the process includes learning to use the toilet regularly and accepting the mechanics of the task: getting into the bathroom, lowering under garments, sitting, releasing waste, wiping, flushing, raising clothing, and most importantly washing their hands at the end of the event.
Children can be encouraged during the process even while accidents continue to happen. Watch for signals from the child, such as tugging at clothes or restless feet. Are these the warning signals that the child needs to go? Ask directly: do you need to use the toilet? When the answer is yes, help them in and get them started and direct them through the process while appearing to be disinterested. If an accident happened, place anything disposable into the toilet itself and explain to the child that "this is where poop should go" without showing any anger or frustration.
Finally, remain positive at all times. You child's body is changing and your child is dealing with those changes without understanding them.