Our online reservation system can be used with magnetic card readers and barcode scanners provided such peripherals are connected via USB and allow keyboard emulation. The cardreader (barcodescanner) provides the cardswipe (scan) as one keystroke. Our system will the look up the corresponding number in the database and return the subject user.

Important detail: the cursor can be anywhere. It does not have to be placed in a particular window (like the window in a login screen).

We are now attempting to add RFID reads to our system and now we have come across something strange. In notepad.exe and windows in our website a RFID tag-read is received as the 10 digit number on that tag. So the keyboard emulation seems to work just fine.

However. Using the RFID reader as the cardreader and barcode reader are being used the tag-read turns up as a string of letters according to the rule: 1=a 2=b 3=d ~~ 9=1 0=blank

If we place the corresponding letter combination in our database the tag-read will return the subject client's name.

Anybody who has an idea as to what causes PHP (or is it HTML) to turn numbers into letters?

Recommended Answers

All 3 Replies

Use an array to hold the letters

$letters = array("","a","b","c","d","e","f","g","h","i");

Then using a simple for loop read the number string and construct a letter string as follows

$numberString = "5423440234";
$letterString = "";
for($i = 0; $i < strlen($numberString); $i++)
{
    $letterString .= $letters[$numberString[$i]];
}

echo $letterString;

I hope I understood your question correctly

First of all thank you for your contribution. However I believe that you misunderstood the question. The problem is not converting numbers to letters, but preventing that numbers are turned into letters. The underlying problem here is that we have no clue why the numbers stay numbers if Notepad etc are being used, but change to letters in this particular webpage.

Sorry about that :) :)
I have no good answer for your actual problem :(

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.