Reading Bar Code Scanner

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I will be starting to work on an e-commerce web site pretty soon, and
one thing the user would like to do is to have a part of the site that
he could use in the store for recording the transaction.  To accommodate
this, our (myself and the other programmer) thought was to use a bar
code scanner to get the product info into the system to cut down on
errors and save time.  However, I'm not sure if this is doable.  Is it
possible with PHP to have a page up and then scan the article, and have
the bar code passed to the script so it can query the database and bring
up the item on the page?  I know the script has to be called by
something, but I'm not sure exactly what could be used.



Re: Reading Bar Code Scanner

Quoted text here. Click to load it

Yes, it is possible.  A bar code scanner is just a glorified keyboard.
Anywhere you can type data in, you can scan a bar code and the date will
show up just like it was typed.  One caveat - make sure you get a scanner
that has built in decoding - meaning it translates what is scanned into
useable data.

Now, if you want to scan and have something automatically happen...

Most bar code scanners allow you to program (usually by scanning a special
bar code that is in the manual) a "post-amble" character.  You would set
this to a LF/CR (Enter).  Then when you scanned on the field the data would
be entered and prepended with an Enter.  The default button on the form
should be the submit button.

So you would scan the value, the data would be entered and the "submit form"
button selected would be processed and the data would be passed to your form
(php script) to do whatever you needed to do with it.

Note:  You can also set your post-amble character to be a "tab" so it will
go to the next field instead of the enter key.

Hope that helps...

Re: Reading Bar Code Scanner

Steve wrote:
Quoted text here. Click to load it

Just in case you're forging ahead under a misconception, barcodes don't
actually store information about the product they're on. They simply
contain numbers (or sometimes alphanumeric characters, in the case of
Code 39 for example) which refer to product details already stored in a
database of some sort. This means that you're not going to have a magic
time-saving solution to putting information into the system in the first

Apologies if that's obvious!

I've used barcodes in a small library system written in PHP, and printed
them using FPDF - available at . There are some neat
extension classes to create labels, too.

For actually creating barcodes in PHP, you might want to have a look at: / /


Re: Reading Bar Code Scanner

It really depends on the barcode... A lot of times the numbers are
codes for categories... For insatnce the number (alphanumeric and
integers) could translate into other meanings.

Just for example of what I am talking about at my work we use barcodes
to find information, the bar code is written in such a way that you can
find the day, year, and unique number for the piece of information you
are looking for.

We use Julian dates where I work (day of the year numerically), the
bar-coded numbers look like: 20042922-0122300, and what that translates
to is 2004 (year) 292 (the numeric date for today) 2 (a sorting number
we use to classify data) and then 0122300 (a unique number for the
information) but the bar codes can even be coded to mean anything.
EX: 11=large 12=small 13=medium 14=custom size, etc..

That is  a bad example of how it may be, but what I am getting at is
that he may be able to develop a bar-code system that uses numeric
feilds to define attributes of whatever he is doing, and in that case
the PHP script would be able to translate those fields into useable
information which is then stored in the database, and would then save
him a bunch of time... Coding would take longer, but be better for the
customer by a long shot.

Site Timeline