However frustrating the situation a child puts an adult in, spanking in not a good choice. It tends to send a message that hitting/violence is O.K. and additionally, it breeds resentment.
First, how old is your child? Is she just learning to use the potty? If so, be patient. As one of the responders commented, being punished for the accident may cause emotional problems for the child, but also potty training may become a battle ground. It is not worth it! Instead, use positive reinforcement: praise your child for when she goes potty. To prevent accidents, schedule regular potty breaks, every couple of hours, for example. And of course, praise your daughter when she is successful!
Second, if your child is older and already potty trained, why does she have accidents now? She might be constipated (yes, constipation may cause frequent urination and accidents in children), or a bladder infection. In this case scenario, she should be evaluated by her regular health care provider asap.
No. Accidents are accidents, and they happen. I am assuming your child is still potty training. Potty training can be a trying task for parents and families, but patience is key. Your child will not understand why you are spanking them, and they could also be made to feel guilty. I know it can be frustrating, but patience is key. When your child has an accident, just calmly clean them up and remind them that any time they have to go potty, they can tell you.
Though I do believe in spanking, unless the child is doing this out of spite, I'd avoid spanking for accidents. Instead, as I suggested to another parent, make potty time fun. If kids are excited about being rewarded, they tend to do what it takes. Make the reward gummy bears, M&M's, tootsie rolls, or you blowing bubbles! Then remind them FREQUENTLY about going potty in the potty chair & getting their reward. Then they will get in the habit & the treats will no longer be an issue. Hang in there!