Definitely go back to the doctor. If your daughter is having pain, she may begin withholding her stool and that's BIG problems. My daughter's pediatrician said that doctors are VERY hesitant to prescribe meds for constipation. Not sure why.
My daughter has had problems with constipation since she was about 9 months old. Of course, by the time we made it to the dr, we had already tried changing her diet with all of the standard recommendations. We also tried Karo syrup, prune juice, etc. The pediatrician prescribed Sorbitol because she was so young. When my daughter got older (can't remember exactly how old) the doctor changed it to Glycolax (Miralax) that others have mentioned already.
Both of these are NON-HABIT forming, which is important to realize. Laxitives over the counter are NOT. The bowels will eventually stop working if they are used on a regular basis and will REQUIRE the laxitive.
My daughter is almost 4 and she is great about taking it, because as noted before, it is tasteless and has no texture. She wouldn't know she was drinking it, except I remind her that she needs to drink all of her juice because it has her medicine in it.
NOTE: Glycolax (Miralax) can take several days to work. Her doctor said that it is best for her to stay on it regularly to keep things moving. I definitely notice a difference!!
PS- The doctor said to make sure she stays well hydrated and also discontinue the med for several days if the child has a stomach bug (diarreah).
Good luck!