Notice: Undefined variable: sent in C:\xampp\htdocs\xampp\contact\index.php on line 41
<p>I have an error message that come up saying "Undefined variable: sent in C:\xampp\htdocs\xampp\contact\index.php on line 41". The code is below. thank you :)</p>

<pre><code>&lt;?php

   $error=false;

    if(isset($_POST['submit']) &amp;&amp; $_POST['submit'] == 'submit' ) {
if(empty($_POST['name']) || empty($_POST['email']) || empty($_POST['comments'])) {
$error = true;
}else {

$to = "thedoc477@gmail.com";
    $name = trim($_POST['name']);
$email = trim($_POST['email']);
$comments = trim($_POST['comments']);
    $subject = "Contact Form";
    $messages = "Name: $name \r\n Email: $email \r\n Comments: $comments";
$headders = "From" . $name;
$mailsent = mail($to, $subject, $messages, $headders);


}
}
?&gt;


&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;

    &lt;head&gt;
        &lt;title&gt;Contact page template&lt;/title&gt;
        &lt;link href="style.css" type="text/css" rel="stylesheet" /&gt;
    &lt;/head&gt;

    &lt;body&gt;
        &lt;div id="wrapper"&gt;
            &lt;?php if($error==true) { ?&gt;
            &lt;p class="error"&gt;There was a missing feild on the form. For you're messiege to be sent please make sure all the fields are all filled in and are corect.&lt;/p&gt;
            &lt;?php } if ($sent==true) { ?&gt;
            &lt;p class="sent"&gt;Thank you for contacting us. We will try to contact you back as soon as posible.&lt;/p&gt;
            &lt;?php } ?&gt;
        &lt;/div&gt;
        &lt;div id="contactform"&gt;
            &lt;form name="contact" action="index.php" method="post" /&gt;
            &lt;label for="name"&gt;Name:&lt;/label&gt;
            &lt;input type="text" name="name" /&gt;
            &lt;/br&gt;
            &lt;label for="email"&gt;Email:&lt;/label&gt;
            &lt;input type="email" name="email" /&gt;
            &lt;/br&gt;
            &lt;label for="comments"&gt;Comments&lt;/label&gt;
            &lt;textarea name="comments" cols="15" rows="10"&gt;&lt;/textarea&gt;
            &lt;/br&gt;
            &lt;input type="submit" name="submit" class="submit" value="submit" /&gt;
            &lt;/form&gt;
        &lt;/div&gt;
    &lt;/body&gt;

&lt;/html&gt;
</code></pre>
