Custom Form - 400 Bad Request

I have a custom file (that should reload itself after a change in my dropdown list). Here is my code (working test code in stand alone file):

 <?php
    $selected = '';
    
    if (isset($_POST["Subject"])) {
        $selected = $_POST["Subject"];
        echo $selected;
    }
?>

    <h1>Demo Dropdown</h1>
	<form name="contact" action="./demo.php" method="POST">
		<select name="Subject" onchange="this.form.submit();">
			<option selected value="Products">All Products</option>
			<option value="Widgets1">Widgets1</option>
			<option value="Widgets2">Widgets2</option>
			<option value="Widgets3">Widgets3</option>
		</select>
	</form>

When I use this code in my custom file (including common files), I get the 400 Bad Request (when the form “action” is called). The code works perfectly in a stand alone file.
What am I missing reloading the file (on change of the dropdown), or more specific what am I missing with the form “action” part?

I also tested with:

action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>" method="POST">

and it’s also working fine in the stand alone file.

You may read CSRF Protection.

Thank you, I must admit I forgot about that.