You're using as $doc instead of as $row here.
foreach($cursor as $doc) {
echo "<tr>";
echo "<td>" . $row['Name'] . "</td>";
echo "<td>" . $row['Marks'] . "</td>";
echo "<td>" . $row['value'] . "</td>";
Change it to the variable you need to use, being $doc and not $row:
$m = new MongoClient();
$db = $m->selectDB('MapData');
$collection = new MongoCollection($db,'ETom4');
$cursor = $collection->find();
//echo "<html><head><body>";
echo "<table>";
foreach($cursor as $doc) {
echo "<tr>";
echo "<td>" . $doc['Name'] . "</td>";
echo "<td>" . $doc['Marks'] . "</td>";
echo "<td>" . $doc['value'] . "</td>";
echo "</tr>";
}
echo "<table>";
//echo "</html></head></body>";
HTML stickler:
You also commented out 2 lines which you're including your markup inside <head></head> and have placed </html> before </body>.
$m = new MongoClient();
$db = $m->selectDB('MapData');
$collection = new MongoCollection($db,'ETom4');
$cursor = $collection->find();
//echo "<html><head></head><body>";
echo "<table>";
foreach($cursor as $doc) {
echo "<tr>";
echo "<td>" . $doc['Name'] . "</td>";
echo "<td>" . $doc['Marks'] . "</td>";
echo "<td>" . $doc['value'] . "</td>";
echo "</tr>";
}
echo "<table>";
//echo "</body></html>";
The syntax/structure is:
<html>
<head>
...
</head>
<body>
...
</body>
</html>
You can also add <!DOCTYPE html> as the first line.
Footnotes:
You also need to make sure of the columns' letter-case.
They are case-sensitive when iterating over rows in a loop.
Therefore Name and name would be considered different.
If (any or all of) the above still doesn't work for you, then you may have errors somewhere.