I'm trying to print out form input using getElementById but it doesn't seem to work. Please help.
<?php
$strhtml = 'DomDoc.html';
// create the DOMDocument object, and load HTML from a string
$dochtml = new DOMDocument();
$dochtml->loadHTML($strhtml);
// get the element with id="dv1"
$elm = $dochtml->getElementById('name');
// get the tag name, and content
$cnt = $elm->nodeValue;
echo $cnt;
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form action="DomDoc.php" method="post">
<input id="name" type="text" name="">
<input type="submit" value="Submit">
</form>
</body>
</html>
`