I take magnesium citrate in a capsule form, Different forms of magnesium absorb better. Citrate is one of the better forms. Oxide which is the cheapest is not. Potassium can also be essential to help stop some people's cramping. (Bananas are a great source for that). I have a bad back and magnesium helps keep the muscles relaxed. I use Natural Vitality's Magnesium Cream sometimes to soothe it when it aches. Natural Vitality also makes several flavored powders you mix and drink. They are quite famous for theirs. Their powder is sweetened with stevia. There are several companies now that do a powdered form cheaper, just make sure it's citrate or glycinate. Natural Vitality switched their powder now to the carbonate form but they add citric acid to make sure it absorbs. They also just came out with ***** bears which are the citrate form and they are only 1 carb each.
I had awful leg cramps at one time, a medication I was on when they thought I was a type 2 caused horrendous leg cramps at night on me, (Januvia). I have a habit of reacting badly to medications though and I also needed insulin so that didn't help I'm sure. Magnesium in tablets, the spray or cream did not help enough. I used Hylands Leg Cramp Cream right before bed and kept it by the bedside in case I woke up with them. But putting a good dose on my legs before bed really helped cut back on how much I was getting them. It didn't completely stop them though and I ended up refusing to take the medication any more. It took a few months for them to go away after I stopped it. A lot of people really like the tablets Hyland's has for leg cramps. I know several people that have used them, I just never did because it had lactose I think, and I'm a vegan.