Why do credit cards have magnetic strips on them?

So that credit card swiping machines can read them.