Hi, new guy here. Ok I have this Add Row to Table script:
And I have the coresponding table in my HTML. But the first three text fields data is generated by php and a mysql DB.
My question is how would I repeat that dynamic value? Example:
[URL unfurl="true"]http://www.connerandassociates.com/pto-pda/rm.php[/URL]
The first 3 pages are just to setup the data for the last page. Please be careful this is very much live. But as you can see the first 3 fields have this:
Or somthing very similar. And the date field has a calendar JS attached as well. Is there a way to repeat these along with the add new row? I have tried this:
But when it repeated the row, none of the text celss showed up.
Any help would be great-- thanks!!
Code:
<script language="JavaScript" type="text/javascript">
// Last updated 2006-02-21
function addRowToTable()
{
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length;
// if there's no header row in the table, then iteration = lastRow + 1
var iteration = lastRow;
var row = tbl.insertRow(lastRow);
// left cell
var cellLeft = row.insertCell(0);
var textNode = document.createTextNode(iteration);
cellLeft.appendChild(textNode);
//2nd cell to left
var cellRight = row.insertCell(1);
var el = document.createElement('input');
el.type = 'text';
el.name = 'rm[]';
el.id = 'rm' + iteration;
el.size = 20;
cellRight.appendChild(el);
// right cell
var cellRightb = row.insertCell(2);
var el2 = document.createElement('input');
el2.type = 'text';
el2.name = 'dm[]';
el2.id = 'dm' + iteration;
el2.size = 20;
cellRightb.appendChild(el2);
//3rd cell to left
var cellRightc = row.insertCell(3);
var el3 = document.createElement('input');
el3.type = 'text';
el3.name = 'store[]';
el3.id = 'store' + iteration;
el3.size = 8;
cellRightc.appendChild(el3);
//4th cell to left
var cellRightd = row.insertCell(4);
var el4 = document.createElement('input');
el4.type = 'text';
el4.name = 'pto[]';
el4.id = 'pto' + iteration;
el4.size = 10;
cellRightd.appendChild(el4);
//5th cell to left
var cellRighte = row.insertCell(5);
var el5 = document.createElement('input');
el5.type = 'text';
el5.name = 'pda[]';
el5.id = 'pda' + iteration;
el5.size = 10;
cellRighte.appendChild(el5);
//6th cell to left
var cellRightf = row.insertCell(6);
var el6 = document.createElement('input');
el6.type = 'text';
el6.name = 'date[]';
el6.id = 'date' + iteration;
el6.size = 20;
cellRightf.appendChild(el6);
}
</script>
And I have the coresponding table in my HTML. But the first three text fields data is generated by php and a mysql DB.
My question is how would I repeat that dynamic value? Example:
[URL unfurl="true"]http://www.connerandassociates.com/pto-pda/rm.php[/URL]
The first 3 pages are just to setup the data for the last page. Please be careful this is very much live. But as you can see the first 3 fields have this:
Code:
<?php echo $row_Recordset1['rm']; ?>
Or somthing very similar. And the date field has a calendar JS attached as well. Is there a way to repeat these along with the add new row? I have tried this:
Code:
var cellRight = row.insertCell(1);
var el = document.createElement('input');
el.type = 'text';
el.name = 'rm[]';
el.id = 'rm' + iteration;
el.size = 20;
el.value = '<?php echo $row_ptopdalisting['rm']; ?>'
But when it repeated the row, none of the text celss showed up.
Any help would be great-- thanks!!