www.webdeveloper.com
Results 1 to 3 of 3

Thread: input data to the textbox after read the barcode using barcode scanner

  1. #1
    Join Date
    Oct 2011
    Posts
    350

    input data to the textbox after read the barcode using barcode scanner

    Hi..


    I just want to know how does it happen that when I scan the barcode using barcode scanner it will automatically put on the first textbox, then the focus will go to the next textbox and on the last textbox will automatically save the data to database.

    here is my sample form.

    PHP Code:
    <?php                                                                          
       error_reporting
    (0);
       
    date_default_timezone_set("Asia/Singapore"); //set the time zone  
    $con mysql_connect('localhost''root','');

    if (!
    $con) {
        echo 
    'failed';
        die();
    }

    mysql_select_db("mes"$con);
    $sr_date =date('Y-m-d H:i:s');

    $sql "SELECT sr_number FROM receiving_materials ORDER BY sr_date DESC LIMIT 1";
            
    $result mysql_query($sql$con);
            
            if (!
    $result) {
                echo 
    'failed'
                die();
            }
            
    $total mysql_num_rows($result);
            if (
    $total <= 0) {
                
    $currentSRNum 1;
                 
    $currentYear  = (int)(date('y'));
                
    $currentMonth = (int)(date('m'));
                
    $currentDay = (int)(date('d'));
               
                
    $currentSRYMD substr($row['sr_number'], 06);
                
    $currentYMD date("ymd");
                if (
    $currentYMD $currentSRYMD
                {  
                    
    $currentSRNum 1;
                } 
                else 
                {  
                    
    $currentSRNum += 1;
                }     
                 
            } 
            else {
    //------------------------------------------------------------------------------------------------------------------
                // Stock Number iteration.... 
                
    $row mysql_fetch_assoc($result);
                
                
    $currentSRNum = (int)(substr($row['sr_number'],0,3));
                
                
    $currentSRYear  = (int)(substr($row['sr_number'],2,2));
                
    $currentSRMonth = (int)(substr($row['sr_number'],0,2));
                
    $currentSRNum = (int)(substr($row['sr_number'],6,4));

                
    $currentYear  = (int)(date('y'));
                
    $currentMonth = (int)(date('m'));
                
    $currentDay = (int)(date('d'));
               
                
    $currentSRYMD substr($row['sr_number'], 06);
                
    $currentYMD date("ymd");
                if (
    $currentYMD $currentSRYMD
                {  
                    
    $currentSRNum 1;
                } 
                else 
                {  
                    
    $currentSRNum += 1;
                }                                           
            }
    //------------------------------------------------------------------------------------------------------------------         
            
    $yearMonth date('ymd');    
            
    $currentSR $currentYMD sprintf("%04d"$currentSRNum);  
    ?>
    <html>
    <title>Receiving Materials</title>
    <head>
    <link rel="stylesheet" type="text/css" href="kanban.css" />
    <style type="text/css">
    #SR_date{
        position: relative;
        font-family: Arial, Helvetica, sans-serif;
        font-size: .9em;
        margin-left: 10px;
        width: auto;
        height: auto;
        float: left;
        top : 10px;
        
    }
    </style>


    </head>
    <body>
    <form name="receiving_form" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">      

    <div id="SR_date">
    <label>Date :</label>
    <input type="text" name="sr_date" value="<?php echo $sr_date?>" size="16" readonly="readonly" style="border: none;">    
    </div>
    <div id="SR_number">
    <label>RM# :</label>
    <input type="text" name="sr_number" value="<?php echo $currentSR?>" size="9" readonly="readonly" style="font-weight: bold; border: none;"> 
    </div> 
    <div id="SI_number">
     <label class="LLabelRM">SI/DR# :</label>
    <input type="text" name="si_num" id="si_num" class="LFieldRM" value="" size="25"> <br/></br/>
    <label class="LLabelRM">Supplier Name :</label>
    <input type="text" name="s_name" id="s_name" class="LFieldRM" value="" size="25">  <br/></br/>
    <label class="LLabelSecRM">PO # :</label>
    <input type="text" name="po_num" id="po_num" class="LFieldSecRM" value="" size="25">
    <label class="LLabelSecRM">Quantity :</label>
    <input type="text" name="qty" id="qty" class="LFieldSec1RM" value="" size="25"> <br/> <br/>
    <label class="LLabelSecRM">Material Code :</label>
    <input type="text" name="mat_code" id="mat_code" class="LFieldSecRM" value="" size="25">
    <label class="LLabelSecRM">Material Desc. :</label>
    <input type="text" name="mat_desc" id="mat_desc" class="LFieldSec1RM" value="" size="25">  <br/></br/>
    <label class="LLabelSecRM">WH Code :</label>
    <input type="text" name="wh_code" id="wh_code" class="LFieldSecRM" value="" size="25">
    <label class="LLabelSecRM">BIN Location :</label>
    <input type="text" name="bin_loc" id="bin_loc" class="LFieldSec1RM" value="" size="25">
    </div> 
    </form>
    </body>
    </html>
    Thank you

  2. #2
    Join Date
    Dec 2013
    Posts
    5
    Please refer to the tutorial of barcode reading found through Google, it might be helpful!

  3. #3
    Join Date
    Aug 2013
    Posts
    30
    which barcode scanner you were using ?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles