So, I have an html form that displays like this:
<span style='required'>*</span> - Indicates required field. <div class='fields'>Swiped Information</div> <input type=text name='swiped' id='swiped'> </div> <div class='fields'>First Name</div> <input type=text name='first_name' id='first_name'><span style='required'>*</span> </div> <div class='fields'>Last Name</div> <input type=text name='last_name' id='last_name'><span style='required'>*</span> </div> <div class='fields'>Expiration</div> <input type=text size=8 name='expiration' id='expiration'><span style='required'>*</span>(MMYY) </div> <div class='fields'>CVV Code</div> <input type=text size=8 name='cvv' id='cvv'><span style='required'>*</span> </div> <div class='fields'>Credit Card Number</div> <input type=text name='card' id='card'><span style='required'>*</span> </div> <hr> <div class='buttons'></div> <a onclick="readCard();" style="cursor:pointer; color:red;">Swipe Credit Card</a> </div>
My knowledge of this kind of material is very poor. I have a basic small credit card reader that connects to a computer via USB. I want to be able to carry by credit card and my site to analyze the information in the form fields that are above.
I added the event onclick=readCard(); to the link below my form, and when it is clicked, a java script is launched to focus on the Swiped Information field, which will store the data string from the magnetic stripe reader.
function readCard () { document.getElementById('swiped').focus(); }
My thoughts are that the employee would hit the “Swipe Credit Card”, which would make the “Chip card information” field a focus and fill this field with a line, then javascript would break this information into pieces and fill out the form accordingly.
I searched high and low to try and find a solution, and closest I could find a tutorial that used asp.net as a language, and I can't do it. Either PHP or JavaScript. Thanks in advance.
All I have to do is split this long string into several and display the relevant parts in html form.
PS I'm not worried about the ATM checking the form, I will take care of it after I manage to fill out the form fields! Thanks!
UPDATE:
I created a JSFiddle, although the java script I inserted does not work. http://jsfiddle.net/r8FJX/
UPDATE:
In accordance with the comments below, I added an example of the data sent from my card reader to the computer. I went in and replaced every number in the line with randomly printed fake numbers and replaced my name with a fake one. (Sorry, scammers!)
%B6545461234613451^DOE/JOHN^00000000000000000000000?;6545461234613451=984651465116111?
I assume that, as the code laid out above, I can not find the documentation:
%Bcardnumber^lastname/firstname^expDate?;cardnumber=expDate?