title: PHP form Submit multiple values through one form field and append to array
body: <p>I have php form that posts data to URL with single field, the problem is I can only submit one value. I have a barcode scanner that I want to be able to scan multiple serial number barcodes and submit the form. I probably need a javascript but I am not sure. See below</p>
  
  <pre><code>&lt;?php
     echo("Serial Number: " . $_POST['serial'] . "&lt;br /&gt;\n");
  ?&gt;
  
  &lt;form action="myform5.php" method="post"&gt;
     &lt;p&gt;First name: &lt;input type="text" name="serial" /&gt;&lt;/p&gt;
     &lt;input type="submit" name="submit" value="Submit" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>So in other words, I want a form field where I can enter multiple serial numbers and be able to post the data to the URL. Since I am using barcode scanner which also submits enter key after each scan, so I want to be able to add multiple serials without touching the keyboard and when finished, should be able to click submit and it posts the data.</p>
  
  <p>The SQL query would be something like this; </p>
  
  <pre><code>select * from hdds where serial IN ('5MQ3DJAA', '5MQ3DJAB', '5MQ3DJAC', '5MQ3DJAB', '5MQ3DJAR');
  </code></pre>
  
  <p>I dont want to use the textarea field, I cannot figure out how to have a single input type text field and have a add button next to it, when a serial number is scanned or entered, that number is added to list below, that number is shown below the field and serials keep adding up when done press the submit button that posts the data. </p>
  
  <p>This is what I am looking to do, see below example.</p>
  
  <p><a href="https://i.stack.imgur.com/TnffU.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TnffU.jpg" alt="enter image description here"></a></p>
  
  <p>I would appreciate a small working example?</p>