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 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;
                switch(newcell.childNodes[0].type) {
                    case "text":
                            newcell.childNodes[0].value = "";
                    case "checkbox":
                            newcell.childNodes[0].checked = false;
                    case "select-one":
                            newcell.childNodes[0].selectedIndex = 0;

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

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


<table id="dataTable" width="597" border="0">
                      <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");
        echo "<option value='$productname'> $productname </option>";

                      <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>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.