I am trying to create a contact form. I would like to display $result below the h1, but I am getting the following notices:
Notice: Undefined index: submit in C:\xampp\htdocs\contact-form\contact.php on line 4
Notice: Undefined variable: result in C:\xampp\htdocs\contact-form\contact.php on line 48
Here is a screenshot: https://www.dropbox.com/s/ltoc8j3j6iyppc5/Screenshot%202016-03-14%2014.14.19.png?dl=0
Line 4 is:
    if ($_POST["submit"]) {
Can anyone provide a clue to what the notice is for?
<?php
$result="test";
    if ($_POST["submit"]) {
        $result="Form submitted";
    }
?>
<!DOCTYPE html>
<html>
<head>
    <title>Contact Form</title>
    <!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
<style>
    .emailForm {
        border:1px solid gray;
        border-radius:10px;
        margin-top:20px;
    }
    textarea {
        height:120px;
    }
    form {
        padding-bottom:20px;
    }
</style>
</head>
<body>
<div class="container">
    
    <div class="row">
        <div class="col-md-6 col-md-offset-3 emailForm">
            <h1>My email form</h1>
            <?php echo $result; ?>
            <p class="lead">Please get in touch - I'll get back to you as soon as I can!"</p>
            <form method="post">
                <div class="form-group">
                    <label for="name">Your Name:</label>
                    <input type="text" name="name" class="form-control" placeholder="Your Name"/>
                </div>
                <div class="form-group">
                    <label for="name">Your Email:</label>
                    <input type="email" name="email" class="form-control" placeholder="Your Email"/>
                </div>
                <div class="form-group">
                    <label for="name">Your Comment:</label>
                    <textarea class="form-control" name="comment"></textarea>
                </div>
                <input type="submit" name="submit" class="btn btn-success btn-lg" value="Submit"/>
            </form>
        </div>
    </div>
</div>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
</body>
</html>
Thanks, any help is appreciated.
 
    