Re: Urine flows when penis straightens up
I'm no expert, but it sounds like your prostate is not completely stopping the flow of urine from your bladder.
Doing "Kegel exercises" might be able to help your problem. Your doctor may have mentioned them. You might read more about them elsewhere.
General stretching and regular exercise could help too.
One maybe unimportant tip: if you strongly need to urinate, you should not masturbate or try to have sex. Urinate first. It's rare, but it's actually possible to injure the prostate (both in ejaculating with a very full bladder or in urinating afterward).