Nollyvenon 0 Newbie Poster

Please i have a form that has textfields dynamically generated and work fine.but i want to have one of the field display from the database while an textfield multiply the value from database for each of the lines.how do i do that?

below is my code:

    <SCRIPT language="javascript">
        function addRow(tableID) {

            var table = document.getElementById(tableID);

            var rowCount = table.rows.length;
            var row = table.insertRow(rowCount);

            var colCount = table.rows[0].cells.length;

            for(var i=0; i<colCount; i++) {

                var newcell = row.insertCell(i);

                newcell.innerHTML = table.rows[0].cells[i].innerHTML;
                //alert(newcell.childNodes);
                switch(newcell.childNodes[0].type) {
                    case "text":
                            newcell.childNodes[0].value = "";
                            break;
                    case "checkbox":
                            newcell.childNodes[0].checked = false;
                            break;
                    case "select-one":
                            newcell.childNodes[0].selectedIndex = 0;
                            break;
                }

                switch(newcell.childNodes[0].name) {
                    case "s_no[]":
                            newcell.childNodes[0].value = rowCount + 1; 
                            break;
                }
            }
        }

        function deleteRow(tableID) {
              var tbl = document.getElementById(tableID);
              var lastRow = tbl.rows.length;
              if (lastRow > 2) tbl.deleteRow(lastRow - 1);

        }

    </SCRIPT>
<table id="dataTable" width="597" border="0">
                    <tr>
                      <td width="20"><input name="s_no[]" readonly="readonly"  type="text" value="1" size="2"/></td>
                      <td width="114"><select name="product[]" id="product[]">
                        <option selected="selected">-- Select Product --</option>
                        <?php $sql1=mysql_query("SELECT * FROM products");
        while($fet=mysql_fetch_array($sql1)){
        $productname=$fet['productname'];
        //$uname=$fet['uname'];
        echo "<option value='$productname'> $productname </option>";

        }?>
                      </select></td>
                      <td width="144"><input name="qty[]" type="text" onblur="getpriceValues('product[]','qty[]')" onmouseout="getpriceValues('product[]','qty[]')" size="10"/></td>
                      <td width="144"><input  name="unitprice[]" type="text" onblur="getpriceValues('product[]','qty[]')" onmouseout="getValues('qty[]','unitprice[]','amount[]')" size="10"/></td>
                      <td width="153"><input name="amount[]" type="text" onblur="getValues('qty[]','unitprice[]','amount[]')" onclick="getValues('qty[]','unitprice[]','amount[]')" size="15"/><div id="unitprice"></div></td>
                    </tr>
                  </table>