Magnesium is a wonderful thing. It can also be a dangerous thing. I took the supplements for years until I found out that they don't absorb well at all and that they don't absorb at all without a mix of a couple other nutrients.(I think it's calcium and zinc but you might want to double check that.)
Instead - I do epsom salt baths. 2 cups to a wonderful hot bath. I only stay in the tub for 20 minutes because that's medicinal strength. If you stay much longer - it'll make sleepy and don't operate heavy equiptment. I had a friend who felt soooooo wonderful he kept adding hot water and more salt for 2 hours. He absorbed WAY TOO MUCH! and it really affected him.
From my research, I've read that magnesium is best absorbed through the skin or in a liquid form. I did take a supplement ( http://naturalvitality.com/natural-calm/
) but it can be harsh on the system (explosive diarrhea - I think it's even on the label or in the directions to adjust according to how you poop.) It can make you lightheaded and doofy, too. That was surprising.
Gatorade has an easily digestable magnesium in it. I keep a couple emergency bottles around (the quart size ones). Charlie horses suck (like headaches).
You can either buy or make magnesium oil. It's a salt (I think they make tofu with it - it's been a while since I researched it). You can get the food grade on Amazon, put in a spray bottle, top with water and shake. It turns into an oil. People spray that right on the spasms. It'll dry out your skin and make you itch because it's literally a salt but I've seen people have great success with it.
If you have any medications - PLEASE talk to your pharmacist. Magnesium does interact with a lot of different meds. It needs to be taken 2 hours apart from some (including the 2 cup bath) and not mixed at all with others.