Here is the answer:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<form>
N: <input type="text" name="num"/>
<input type="submit"/>
</form>
<?php
if (isset($_GET['num'])) {
$num = intval($_GET['num']);
for ($i = 0; $i <= $num; $i++) {
if ($i % 2 == 0 && $i != 0) {
echo $i . " ";
}
}
}
?>
</body>
</html>