title: Insert value in DB with form on a barcode scanner
body: <p>I have a Datalogic Barcode Scanner Falcon 4410. I have a html form on it to add products into a database.
  Here is my simple form :</p>
  
  <pre><code>&lt;form id="formprod" class="form-horizontal" method="post" action="url"&gt;
      &lt;fieldset&gt;
      &lt;!-- Text input--&gt;
      &lt;div class="form-group"&gt;
        &lt;label class="col-md-4 control-label" for="textinput"&gt;Référence&lt;/label&gt;  
        &lt;div class="col-md-4"&gt;
        &lt;input id="textinput" name="reference" type="text" placeholder="placeholder" class="form-control input-md"&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;!-- Button (Double) --&gt;
      &lt;div class="form-group"&gt;
        &lt;div class="col-md-8"&gt;
          &lt;input type="submit" id="button1id" name="submit" value="OK" class="btn btn-success"/&gt;
          &lt;input type="reset" id="button2id" name="button2id" value="RESET" class="btn btn-danger"/&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;/fieldset&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>So, in the barcode scanner if I open my html page, write with virtual keyboard in input and submit with submit button: it works. 
  But if I'm scanning a barcode, form is automatically submitted, record is saved but reference field is empty in DB.
  My PHP code :</p>
  
  <pre><code>&lt;?php
  if(isset($_POST["reference"])){
      $hostname='****';
      $username='****';
      $password='*****';
  
      try {
          $dbh = new PDO("mysql:host=$hostname;dbname=name",$username,$password);
  
          $dbh-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
          $sql = "INSERT INTO product (reference)
          VALUES ('".$_POST["reference"]."')";
          if ($dbh-&gt;query($sql)) {
          echo 'Done!';
          }
          else{
          echo 'Error!';
          }
  
          $dbh = null;
      }
      catch(PDOException $e)
      {
          echo $e-&gt;getMessage();
      }
  }
  </code></pre>
  
  <p>Do you have an idea?
  Thanks.</p>
  
  <p>PS : It's not optimized for SQL injection for example, it will be done when record will work</p>
  
  <p><strong>EDIT : WORK AFTER A REBOOT.</strong></p>