im an IT student currently studying PHP, JS, and HTML/CSS can someone help me why this causes an error "Undefined variable: name" from that span line (even after submitting "name" in forms). thank you very much
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">
<p> Name: <input type="text" name="name" placeholder="Input Name Here..."></p>
<span><?php echo $name?></span>
<button type="submit">Submit</button>
</form>
PHP
if($_SERVER["REQUEST_METHOD"] == "POST"){
$name = $_POST['name'];
}