One of the reasons for fainting is orthostatic hypotension where your blood pressure suddenly drops when you stand up, you could also have had low blood glucose levels. You should be keeping a close watch on your BP and see if it drops from lying to standing position.
Also avoid straining while having bowel movements because it can cause fainting spells by causing low blood pressure. If you are constipated try to include more fiber in your diet. Also try to keep yourself hydrated by drinking plenty of water.
Next Steps
when you get up from lying position and if you feel dizzy, please lie back down and lift your legs up while lying down.This will increase blood flow back to your brain
Health Tips
Did you ever have any test done for your heart when you were taken to the hospital last time?