如何使这个PHP联系表格工作?

I got this free bootstrap temp for a restaurant. And I am trying to make my first contact form, but I have no idea how this works as it is so different from HMTL code.

I take it I have to change the PHP and put my own email address in it at $toEmail but when I try it and test it on XAMPP it does not work.

I have this for my PHP:

<?php
if (isset($_POST['submit'])) { 
  $name = $_POST['name'];
  $email = $_POST['email'];
  $ToEmail = 'test@test.com';
  $EmailSubject = $_POST['subject']; 
  $mailheader = "From: ".$_POST["email"]."
"; 
  $mailheader .= "Reply-To: ".$_POST["email"]."
"; 
  $mailheader .= "Content-type: text/html; charset=iso-8859-1
"; 
  $MESSAGE_BODY = "Name: ".$_POST["name"]."<br>"; 
  $MESSAGE_BODY .= "Email: ".$_POST["email"]."<br>"; 
  $MESSAGE_BODY .= "Subject:".$_POST['subject']."<br />";  
  $MESSAGE_BODY .= "Message: ".nl2br($_POST["message"])."<br>"; 
  if(mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader))
  {
  echo "<script>alert('Mail was sent !');</script>";
  echo "<script>document.location.href='http://localhost/restaurant/'</script>";
  }
  else
  {
  echo "<script>alert('Mail was not sent. Please try again later');</script>";
  }
 }

And this in my html

<div class="inner contact">
  <!-- Form Area -->
  <div class="contact-form">
    <!-- Form -->
    <form id="contact-us" method="post" action="contact.php">
      <!-- Left Inputs -->
      <div class="col-md-6 ">
        <!-- Name -->
        <input type="text" name="name" id="name" required class="form" placeholder="Naam" />
        <!-- Email -->
        <input type="email" name="email" id="email" required class="form" placeholder="Email Adres" />
        <!-- Subject -->
        <input type="text" name="subject" id="subject" required class="form" placeholder="Onderwerp" />
      </div><!-- End Left Inputs -->
      <!-- Right Inputs -->
      <div class="col-md-6">
        <!-- Message -->
        <textarea name="message" id="message" class="form textarea"  placeholder="Bericht"></textarea>
      </div><!-- End Right Inputs -->
      <!-- Bottom Submit -->
      <div class="relative fullwidth col-xs-12">
        <!-- Send Button -->
        <button type="submit" id="submit" name="submit" class="form-btn semibold">Verstuur Bericht</button> 
      </div><!-- End Bottom Submit -->
      <!-- Clear -->
      <div class="clear"></div>
    </form>
  </div><!-- End Contact Form Area -->             

Can someone please point me in the right direction? Which parts do i need to edit for it to work?

As an alternative to the Dhinju Divakarans answer, you can change the mail server settings to use an external mail server (e.g. gmail)

I did this by editing the /xampp/sendmail/sendmail.ini. look for the following code and change the values. In my case the following works fine:

smtp_server=smtp.googlemail.com
auth_username= (put the gmail email address here)
auth_password= your password
hostname=smtp.googlemail.de

I don't touched the other settings.

Maybe you also want to have a look at this answer.

Mail function doesnt work in localhost(XAMPP) you should host it a server and run it