How to clear form data, after submit, but after data passed
<p>I've been looking for over 2 days for solution to this problem of mine. Went through all the related posts on stack, but no luck. I have a form that accepts data, then passes on to a php procedure to process it which in turn calls on a html thank you page. I am not at all familiar with Javascript or JQuery but can make it work after spending some time. I am posting the codes here along with many suggestions that I tried to no avail. Any help that ends my misery is appreciated. Thanks. </p>

<h1>HTML</h1>

<pre><code>&lt;form method='post' action='contact-form-proc.php' name='contactform' id='contactform' onsubmit="setTimeout('clear_form()',200);return true"&gt;
    &lt;p&gt;
    &lt;label for='fullname'&gt;Your Name:&lt;/label&gt;&lt;br/&gt;
    &lt;input type='text' name='fullname' /&gt;
    &lt;/p&gt;

    &lt;p&gt;
    &lt;label for='email' &gt;Email Address:&lt;/label&gt;&lt;br/&gt;
    &lt;input type='text' name='email' /&gt;
    &lt;/p&gt;

    &lt;p&gt;
        &lt;label for='mobile' &gt;Mobile:&lt;/label&gt;&lt;br/&gt;
        &lt;input type='text' name='mobile' /&gt;
    &lt;/p&gt;
    &lt;p&gt;
        &lt;label for='checkIndate' &gt;Check in Date:&lt;/label&gt;&lt;br/&gt;
        &lt;input type='text' name='checkIndate'/&gt;
    &lt;/p&gt;
    &lt;p&gt;
        &lt;label for='comment' &gt;Comment:&lt;/label&gt;&lt;br/&gt;
        &lt;textarea name='comment' cols='25' rows='3'&gt;&lt;/textarea&gt;
    &lt;/p&gt;

    &lt;input type="image" src="submit.gif" name="submit"/&gt;
    &lt;!--&lt;input type='submit' name='submit' value='' id="submit" /&gt;--&gt;
    &lt;input type="hidden" name="submit" value="Submit"/&gt;

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

<h1>PHP</h1>

<pre><code>&lt;?php

if(empty($_POST['submit']))
{
    echo "Form is not submitted!";
    exit;
}
if(empty($_POST["fullname"]) ||
    empty($_POST["email"]))
    {
        echo "Please fill the form";
        exit;
    }

$name = $_POST["fullname"];
$email = $_POST["email"];
$mobile = $_POST["mobile"];
$checkindate = $_POST["checkIndate"];
$comment = $_POST["comment"];

mail( 'xxx@xxxxxx.com' , 'New form submission' , "New form submission: Name: $name, Email:$email, Mobile: $mobile, CheckIndate:$checkIndate, Comment:$comment"  );

header('Location: thank-you.html');


?&gt;
</code></pre>

<h1>These are what I tried:</h1>

<pre><code>&lt;script type="text/javascript"&gt;
       /*$('#contactform').trigger("reset");*/
       function clear_form() {
      /*    document.contactform.reset();

                document.getElementById("contactform").reset();*/
    /*$(window).load(function() {
        $('#contactform input[type="text"]').val('');*/


        $(window).load(function() {
                $('#contactform').children('input').val('');
                }

        });
                }
  &lt;/script&gt;
</code></pre>