<?php if (isset($_GET['var'])) {?> <script type="text/javascript"> document.getElementById('dateForm').submit(); // SUBMIT FORM </script> <?php } else { // leave the page alone } ?>