0

I have a table like this

<table id="table_v3">
<tr> 
<td>
<select onchange="showOdds_h(3,1);" id="hSelect_3"><option value='3' selected>Crown</option><option value="31" >Sbobet</option><option value="8">Bet365</option><option value="12">Easybets</option><option value="24">12bet</option></select>
</td>
</tr>

<tr id="tr3_1">
<td>
    Showing data everytime Client change value of above SELECT (EX : 0.5)
</td>
</tr>
</table>

Everytime Client change value of SELECT ELEMENT a javascript code will generate value for TD Tag ( I noted above ) .

I write below code to print out all values of TD but it didnt show default value which generated by javascript code

<?php

$html = '<table id="table_v3"><tr><td><select onchange="showOdds_h(3,1);" id="hSelect_3"><option value='3' selected>Crown</option><option value="31" >Sbobet</option><option value="8">Bet365</option><option value="12">Easybets</option><option value="24">12bet</option></select></td></tr><tr id="tr3_1"><td>Showing data everytime user change value of above SELECT ELEMENT (EX : 0.5)</td></tr></table>';


$xml = new DOMDocument();

$xml->loadHTML($html);

$xpath = new DOMXPath($xml);

$table =$xpath->query("//*[@id='table_v3']")->item(0);

$rows = $table->getElementsByTagName("tr");

foreach ($rows as $row){
    $cells = $row -> getElementsByTagName('td');
    foreach ($cells as $cell) {
        print $cell->nodeValue.'</br>'; // print out values TD
    }
}

?>

but it didnt show the value which generated by javascript code. Is there anyway of codes or solutions we can do that? . Im new at PHP & DOMDOCUMENT so hope everybody help me. thanks alot.

P/S : Function showodds we can view in this link : http://www.nowgoal.com/Data/analysis.js . Thank guys.

Mikev
  • 2,012
  • 1
  • 15
  • 27
bambostar
  • 45
  • 8

0 Answers0