Most magnetic strip readers (MSR's) can operate in keyboard emulation mode. In that mode, the data is received by your computer just as though the data stored in the mag stripe had been typed in from the keyboard. Thus, you can simply put the cursor in the appropriate text field and swipe the card to see the data stored on the stripe appear in your database.
I believe that some MSR's can be programmed to put a "post-amble" on the end of the stream of data from the swiped card. If you can program the post-amble to be a Return or Tab character, you can use an "On Exit" script trigger to respond to the swipe and process the data from the card.