Why is my PHP Code not Working , HTML website?

  css, html, php

Ok so i made a HTML website for a school project and i tried incorporating into it a " Contact Us " section in which u give your name , email and a message to be sent to my adress. I can’t seem to find any error into the code . When i am trying to send the info , instead of executing the php , it opens a new white Web Page and no mail is sent.

**That’s how the Page looks like and what happens when i Submit : https://imgur.com/a/1mLaIa4 **
( as u can see the files are located in the same folder so that’s not a problem )

That’s my code HTML :

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Contact Page</title>
<link rel="stylesheet" href="style2.css" type="text/css" media="screen" />
<link rel="icon" href="icon2.png" type="image/x-icon"/>

</head>
<body>


<div class="container">
  <div style="text-align:center">
    <h2>Contact Us</h2>
    <p>Leave a message or a suggestion:</p>
  </div>
  <div class="row">
    <div class="column">
      <img src="gif3.gif" style="width:100%;">
    </div>
    <div class="column">
      <form id="column-form" method="post" action="column-form-handler.php">
        <label for="fullname">Full Name</label>
        <input type="text" id="fullname" name="fullname" placeholder="Your full name.." required>
        
        <label for="email">Email</label>
        <input type="email" id="email" name="email" placeholder="Your email adress.." required>
       
       <label for="country">Country</label>
        <select id="country" name="country" >
          <option value="australia">Australia</option>
          <option value="canada">Canada</option>
          <option value="usa">USA</option>
        </select>
        
        <label for="subject">Subject</label>
        <textarea id="subject" name="subject" placeholder="Write something.." style="height:170px"></textarea>
        <input type="submit" value="Submit">
      </form>
    </div>
  </div>
</div>

</body>
</html>

And here is the PHP :

<?php
     
    $name = $_POST['fullname'];
    $visitor_email = $_POST['email'];
    $message = $_POST['subject'];
    
    $email_from = '[email protected]';
    $email_subject = "Website Messages";
    $email_body = "User Name: $name.n".
                     "User Email: $visitor_email.n".
                       "User Message: $message.n";
                       
    $to = "[email protected]";
    $headers = "From: $email_from rn";
    $headers = "Reply-To: $visitor_email rn";
    mail($to,$email_subject,$email_body,$headers);
    header("Location: contact.html");
    
    
    ?>

Source: Ask PHP

LEAVE A COMMENT