Does the white foam ONLY come out from your vagina while you are having sex?
Do you have any discharge from your vagina when you are not having sex?
Do you have any peculiar odor from your vagina?
What are the names of the pills that you are taking for cervical infection?
Did a doctor diagnose a cervical infection? If so, what is the name of the cervical infection that the doctor prescribed the pills for?
You most likely have trichomoniasis.
Trichomoniasis can cause a frothy vaginal discharge with a strong odor.
Trichomoniasis is treated with metronidazole twice a day for 7 days. Be sure to take all of your medication and take it according to your doctor's instructions.
Your partner should also be treated. An infected man, even a man who has never had symptoms or whose symptoms have stopped can continue to infect or re-infect a female partner until he has been treated. You and your partner should avoid sex until you both complete treatment and have no symptoms.
Here is a link to a web site with information about trichomoniasis: http://www.cdc.gov/std/Trichomonas/STDFact-Trichomoniasis.htm#symptoms