title: call a javascript function within a while loop
body: <p>I have a php while loop that iterates through a series of records for printing.  This works fine.  Now I need to add in an isbn barcode.  I have a similar program that does this through javascript, and I used it in a function here, the function is:</p>
  
  <pre><code>&lt;script&gt;
  function get_bar() {
      var isbn = $('#isbn').val();
  $("#barcode").barcode(isbn, "ean13",{barWidth:3.00, barHeight:35, fontSize:20, output:"bmp"});
  }
  </code></pre>
  
  <p> </p>
  
  <p>I am calling this within the while loop just at the end of it.  it works for the first record I need it in (the input), but not any of the subsequent records.  This file could have up to 100 pages that will need to be printed out.  here is a sample of the php code:</p>
  
  <pre><code>$result = $conn-&gt;query("select * from ship_assign where po = '$po' limit 0,10");
  $pages = $result-&gt;num_rows;
  
  while ($row = $result-&gt;fetch_assoc()) {
  $isbn10 = $row['isbn10'];
  $isbn = $row['isbn13'];
  $qty = $row['qty'];
  $paid = $row['paid'];
  ...
  ?&gt;
  &lt;script&gt;
  function get_bar() {
      var isbn = $('#isbn').val();
   $("#barcode").barcode(isbn, "ean13",{barWidth:3.00, barHeight:35, fontSize:20, output:"bmp"});
   }
  &lt;/script&gt; 
  &lt;div id="page"&gt;
  &lt;div id="topper"&gt;
   &lt;input id="isbn" value="&lt;?php echo $isbn;?&gt;" style="width: 200px;" placeholder="ISBN13" /&gt;
  &lt;script&gt;
  get_bar();
  &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  &lt;?php
  $x++;
  } //END OF WHILE STATEMENT
  
  $conn-&gt;close();
  ?&gt;
  </code></pre>
  
  <p>I have eliminated a section of the html and php for brevity since that all works.<br>
  How do I get this function to work on all iterations for the loop??</p>