Using barcode scanner with php

hi all does anyone know if i can use a barcode scanner to be intergrated with the web-browser and show stuff on the screen?

u scan/enter barcode
each product get shown on the screen is this possible?

i heard this can be done with using this

<body onload="document.form.code.focus()"></body>

Is this a good way to do it using php and mysql?

I know it’s possible as one company I worked for in 2008 used that to scan products for delivery.
I don’t know how it was done exactly as I wasn’t engaged in that project.