PHP and Barcode Scanners - php

If i have a website running php and apache, what do i need to be able to attach a scanner to it? How do i get the scanner to fill in a value on one of the webforms on my page?

I just did this for an application. It's actually simple. The scanner is just another input method and is, in fact, similar to a keyboard. When you scan the barcode the data is decoded by the scanner and sent to whatever application is waiting to receive it. In the case of a web-based application it would be a form, most likely with a textarea with focus. The data would then populate the textarea just as if someone had typed the barcode's data into it. The form is then submitted and processed normally.
Just make sure the textarea has focus or else the data will go either nowhere or to wherever focus is (which may be another form field or the address bar).
I have yet to figure how how to get the form to auto-submit upon the entry of the barcode data as the scanner does not send event information (i.e. submit) and special characters such as tab (\t) do not seem to work. (If anyone knows how to accomplish this I am very interested in knowing how it can be done).

For actually creating barcodes in PHP, you might want to have a look at:
http://www.mribti.com/barcode/
http://www.ashberg.de/php-barcode/

Usually, these scanners are equivalent to a keyboard input, so you just select the appropriate input point on the web page, scan, and then submit the form.

WASP makes a line of barcode scanners that simply plug into USB or PS/2 inputs and basically convert the barcode scanned into the characters, just like a user typed them using a keyboard. They have an FAQ and help videos that may be of assistance, too.
When designing your web app, depending on how users interact with it, you can use Javascript to move focus from one field to another so that a user can scan barcodes sequentially without having to click on the field where the characters go. (Similar to how some forms move focus as you type data with a known length, such as a zip code or phone number.)

You can try this:
I think this is the best way to integrate barcode in web application
using php.
integrating barcode scanner into php application?
I hope this link is usefull to all.

Using an autofucus input is the better way. You just have to make sure that you create a for and add autofocus to the input box. So each time a user scans any item, the form is automatically submitted. So just give the form an id and handle the data easily with jquery

Related

Barcode submit form

Is it possible to create barcode to submit HTML form and do MySQL update via PHP? I've never done something like that, but currently I'm building some application that will track job done in some Injection Mold company. Can I use mobile barcode scanner or we need dedicated barcode scanner? First, I thought about barcode that will automatically open URL in form like this
https://example.com/verif.php?pos=12&op=10&true=1
And that link will submit form I want. Or something like barcode scanner directly submit form without opening URL? I need advice.
Thanks!
I've worked with barcode scanners before. The barcode represents a string, and all that the scanner will do is read and paste it onto whatever format you have on the computer, in my case, it was on excel sheets, a field in an app, etc. Your scanner will come with a program where you can customize the action upon scanning.
You can definitely use a mobile scanner.
If you want it to submit a form without opening URL, you need to create a form submission platform, which needs to automatically submit and automate that process. Speed can be a key depending on how quickly you expect to scan.

program a barcode scanner to append TAB rather than ENTER

I'm developing an web based Application using PHP & MySQL. My application requires the user to shot a Barcode Scanner to an AUTOFOCUS-ed field in my product entry form, after this AUTOFOCUS-ed field is filled with code shot form the BARCODE Scanner, the form presents a list of similarly coded products (THe products I'm scanning could have similar Barcodes but different Prices), out of which the user needs to select a particular product.
The Scanner I'm using is TVS BSC-101 STAR Scanner, which is most popular in India. The problem is that it is reading ENTER as appending code and I need to program it to append TAB (or something that emulates the TAB button on Keyboard) otherwise it is just not moving to the next field where the user based on the code scanned, gets a list of similarly coded products list.
Can anyone help me out in here, appreciate your help.
reading enter should trigger a page reload, isn't it?
if that's the case, implement a PHP function that read the barcode and output the similar ones.
otherwise you could inhibit the enter keypress via javascript and simulate a tab keypress

How to insert value from barcode reader into form input when the form page is minimized?

I have developed an attendance taking system with PHP and I am running it on localhost. The system is like this:
Suppose a student has a bar coded ID card and to take his attendance there is a barcode reader and the form I have developed. The barcode reader I have automatically pushes the submit button so as soon as I trigger the barcode reader's button, the value from the barcode is taken and after some processing some values are inserted into the database.
Now it is working fine, but the problem is every time I take the attendance I need to open up the form first and then take the attendance. (I need to take attendance several times a day.) I was wondering if there is any way to take the attendance without having to open up the form repeatedly.
If there is no solution for it, is it possible to keep the form page minimized and take attendances while someone is working on computer (doing something else)?
This depends on how your barcode reader works, mostly. I infer from your description that:
The barcode reader, when activated, sends the data and emulates Enter
The data is populated in the active input element, or, I assume, anywhere that keyboard characters are accepted. Can be tested by opening a text editor and seeing if the data is accepted followed by a newline.
Next, you have a web application, which doesn't run in the background. Technically it's still active on the browser even while minimized, but once minimized the browser is no longer the application with focus, and therefore the data doesn't go to it.
So you have two problems:
You need a way to get data from the barcode reader without affecting the current application. In other words, if someone is using a word processor, you don't want the barcode reader to suddenly insert random information in their work.
You need an application or service to "listen" to the barcode reader and interact with the database. You could write it so that it pops up a dialog or something in the event of a misread, incorrect attendee, etc.; however if the computer needs to be used for something else while attendance is being taken, that could be annoying.
Hopefully your barcode reader vendor has some information available to you which can help you solve problem 1. As for problem 2, I don't have any advice except to consider rewriting your application as a service or application that you can minimize.
I would imagine the scanner comes with software that in one way or another, would let you execute a command when a barcode scan event occurs.
then just craft the command
php attendance.php "...barcode data..."
I bet the scanner comes with documentation that would be at least somewhat helpful.

Editing information from a MYSQL database from website frontend.

I wonder is someone can help, I'm building a website, which is driven from a database. It will consist of user submitted information.
Currently all the information is pulled from a record in the database and is being output via a PHP echo, what i would like too do is add a feature that would allow me to edit the information if incorrect from the websites front end.
I have seen many websites have some form of edit icon next to information in there databases, when clicking this icon the echoed text changes from text to a text field and you are able to update the field being echoed from the database.
Im a designer so have limited knowledge of how functionality for this kinda feature might work.
please could anyone let me know how something like this might be achieved.
many thanks.
You would need to build some kind of javascript functionality to allow the in-place editing of those data bits. One possible solution is a jQuery plugin like jEditable.
Then you need to build a server-side script in something like PHP or ruby where it would take the submitted information and update the database.
well the process is the same for the front-end and back-end. it depends whether you want you build a password protected editable forms or just editable for everyone.
One way you can do this is
echo your information into text inputs
give them a css class that removes the border and makes it transparent
make it readonly(so someone couldnt tab into it and change it)
add a javascript onclick event that changes the class to a normal
text box that is not readonly
add a javascript onchange event that uses ajax to save the new
information into the database when they are done typing, or press enter
after the ajax is done turn the text box back to the first css class
EDIT also add a onblur event that changes it back as well
you could even change the cursor for the text input to a pointer instead of the default (text) cursor so that is looks like you can click on it.
.
now html5 has contenteditable attribute which you can set for elements
simple example:
www.hongkiat.com/blog/html5-editable-content/
simpler demo:
https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_global_contenteditable

view data from html form before submitting

i am really stuck here i have been trying and i am posting here hope some one will help me.
i have a html form where i enter my data and before submitting i need to view my data in the html form and if i need changes change it rt there and submit .
i am able to enter data and how do i display the data without submitting.
To preview your form data before posting you have two options basically: the first is to preview it by using JavaScript to dynamically open a new window and then show your data formatted as you want, the second is to post your data to your server and return a new page containing the data you posted but not yet being integrate to your database, this is a kind of confirmation page, whatever is the option there should be a confirmation button to accept or reject the submission and integration of the data in your database.
The second option requires you to create a new page on the server side for confirmation (preview), having all the power of your web server language.
In general, you have a Preview button and a Save (or Post) one.
The Preview button submits the data which is processed by the server-side script (interpreting markup language, or filtering HTML or other stuff) and converted to HTML, then sent back to the user along with the text field with the raw data.
Then the Save/Post button does the same, but saves the data to the database, and similarly output the HTML, without the text field.
A quite generic answer to a quite generic question...
The question that comes to my mind is how this preview would look different from the data entry page. I mean, if the user is supposed to enter, say, name, address, and favorite color, presumably that data is visible on the screen as they type it. What would a preview do? If you're talking about some sort of validation, like color must be on your list of approved colors or some such, then you have two basic choices: You could do the vaildation with JavaScript before sending to the server, or you could send to the server and let it do validation. I would point out that if you do client-side validation, you really should still validate on the server, esecially if there are security or hacking issues. You have no assurance that the data stream sent to your server really came from the page that you sent to the user. The user could create his own page to send data to your server.
The only other thing I can think of is a formatting preview, like here on Stack Overflow where what you type in may include codes that control format. In that case you might want to use Javascript to give immediate feedback, again, like is done here.
perhaps you can have two buttons one as a preview and one as submit so when u preview it sends the form value in a different page and displays it in a format you want.
The submit button will just do the submitting etc. what u plan to do .
hope that helps

Categories