I'm really having a hard time with accessing my html table from PHP.
This is what I have:
file.php
<?php
...some php code
$someValue = '2012';
?>
<script language='javascript'>
var table = document.getElementById('tableId');
for (var i = '<php echo $myVar?>',row; row = table.rows[ '<php echo $myVar?>']; i++) {
//iterate through rows
//rows would be accessed using the 'row' variable assigned in the for loop
for (var j = 0, col; col = row.cells[j]; j++) {
//iterate through columns
//columns would be accessed using the 'col' variable assigned in the for loop
col.innerHTML = '<?php $someValue; ?>'
}
}
</script>
<?php
... continue php codes.
?>
Do I make sense here? I wanted to place the $someValue to my table cell.
Help
The flow is something like this... I have
file-1.php
- contains my table
- contains file-1.js
file-1.js
- has an ajax object that executes file-2.php
then I wanted file-2.php to access the table in file-1.php and fill out the cells with the values generated in file-2.php