As long as you do not have a medical problem, the only thing needed to get rid of constipation is a proper diet and exercise. As far as your diet goes, two things are very important in order to pass normal stools. First of all, you should make sure that you drink plenty of water daily. Dehydration is a sure way to develop constipation, and if you are chronically constipated, it may be an indication that you do not drink enough water. Around eight glasses of water a day should be enough for most people, but you may need more or less depending upon the weather and the extent and intensity of physical activity that you are engaged in. Secondly, you should eat plenty of fruits and vegetables, so that you have an adequate intake of dietary fiber. Fiber is absolutely essential for proper digestion and passing of stools. Besides fruits and vegetables, foods such as whole grains, flax seed, and psyllium husk are excellent sources of fiber, and you can increase your intake of these foods. A simple and easy treatment would be to simply consume a dose of psyllium husk daily. This is usually available in the form of a powder that is to be added to water or to any other drink.
As far as exercise goes, a hard physical work out is not necessary - any strenuous activity for half an hour a day will do. This can be walking, jogging, swimming, cycling, or aerobic exercises, whatever you enjoy doing.
If it has been several days since you passed a stool and these measures do not work, then as a last resort you can try using laxatives. You can take a tablespoon milk of magnesia before going to bed at night, but do not make this a habit. Milk of magnesia is not harmful or habit forming, but it is generally better to rely only on your diet and lifestyle, instead of such interventions. If this too does not work, you can try any mild laxative that is available over the counter. These drugs however should certainly not be used regularly, unless they have been prescribed by a doctor, as this will lead to dependence on medication for a normal stool. Finally, if even a mild laxative does not work, you will have no option but to visit your doctor. In severe cases, physical intervention may be required, and sometimes an underlying problem may need to be treated.
answered by G R