Hello everyone

I'm learning PHP because I want to develop some websites and have I set up web development environment.

I am using XAMPP + YII + Eclipse PHP IDE

Everything works perfectly but I was following a guide and eventhough I followed step by step, I'm getting an error that isn't supposed to be there.

Code:
<!DOCTYPE HTML>

<html>


<link rel="stylesheet" type="text/css" href="css/main.css">


<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Contact Form</title>
</head>

<body>

    <header class="body">
    </header>

    <section class="body">
<?php
    $name = $_POST['name'];   <!-- This is where I get the error undefined index name?>
    $email = $_POST['email'];
    $message = $_POST['message'];
    $from = 'From: DEMO'; 
    $to = '[email protected]'; 
    $subject = 'Hello';
?>
  <form method="post" action="index.php">
        
    <label>Name</label>
    <input name="name" placeholder="Type Here">
            
    <label>Email</label>
    <input name="email" type="email" placeholder="Type Here">
            
    <label>Message</label>
    <textarea name="message" placeholder="Type Here"></textarea>
            
    <input id="submit" name="submit" type="submit" value="Submit">
        
</form>

    </section>
 
    

    <footer class="body">
    </footer>

</body>

</html>
I am getting the error in the php script that I've embedded inside the index.php file, so yeah the html and php code are in the same index.php file , that's why the form is pointing to the same file.

Any help will be appreciated. Thank you