hello
A few days ago I already posted a topic like this, but it's like 5 pages far, so nobody will look at it anymore...
I would like to extract all the data inside the cells of a HTML table.
I feel there is no other way then using regular expressions to do this, but this lacks of manuals, so I don't really know what/how to do it... I tried with this (simplified) code, and of course, it doesn't work:
echo $origineel = "<table> <tr><td>1)</td><td>een</td><td>10</td><td>20</td><td>5</td></tr> <tr><td>2)</td><td>twee</td><td>10</td><td>20</td><td>5</td></tr> <tr><td>3)</td><td>drie</td><td>10</td><td>20</td><td>5</td></tr></table>";
$resultaten = preg_match("/\<td\>(.*)\<\/td\>/s", $origineel);
print_r(array_values($resultaten));
foreach ($resultaten as $ding) {
foreach ($ding as $uit){
echo htmlspecialchars($uit);
echo "<br><hr><br>";
}
}
this code doesn't form an array...
the real code has <td>'s that are more difficult, but if this works, I think I can finish the rest...
There's no way I could use a string replace, the only thing I might do is find the starting position of a cel (<td>) and then the first ending position of a cel (</td>) and with substr() extract the content of the cell, but this doesn't seem very handy, especially if I start working with arguments for every cell, like background color, width and so on.