Redirect Browser Back Button to home page

I am wondering how can I redirect to the last page(i.e contact_us.php page) with no data input when user click on browser back button.
so lets say i am on contact_us.php page, when user click in submit on this page it will go to “thankyou.php” page. Now from this page when user click on browser back button i want to redirect to “contact_us.php” page but with no data input (with blank fields). I appreciate if someone can guide me with correct and simple solution.
thank you

Use a session and a flag value that picks up if a value is set then redirect…

<?php
session_start();
if( isset( $_SESSION['completed']) ) header("Location: index.php");

the above would be in your contact form to test if that variable is set

in your thankyou page you would start a session and set that value so that if someone were to click the back button, the contact page would detect that the session variable has been set and then push the server to serving up the home page.

Thank you for the reply, but i solved it with javascript function. Basically now it disable browser back button instead redirecting to any page. and then user can click on the any other page links from Thankyou.php page.

i have write javascript on contact_us.php form and and called the function on the same page in body tag.

javascript:
<SCRIPT type=“text/javascript”>
window.history.forward();
function noBack() { window.history.forward(); }
</SCRIPT>
<body onload=“noBack();” onpageshow=“if (event.persisted) noBack();” onunload=“”>