PHP, HTML: Submit form automatically -


i have php page html form on it. if variables set in url automatically submit form on page.

ie:

if (isset($_get['var'])) {   // submit form } else {   // leave page alone } 

edit:

here have using answer provided below, it's still not working. form submit if condition met.

<?php  if ($r == 1) {  echo "     <br>    <form action=\"bookroom.php\" method=\"post\" id=\"dateform\">     <input name=\"from\" type=\"hidden\" value=\"$fday/$fmonth/$fyear\">     <input name=\"to\" type=\"hidden\" value=\"$tday/$tmonth/$tyear\">     <input type=\"submit\">    </form>    <script type=\"text/javascript\">     $('#dateform').submit();   </script> ";       } ?> 

using pure javascript instead of jquery :

<?php     if (isset($_get['var'])) {?>  <script type="text/javascript">     document.getelementbyid('dateform').submit(); // submit form </script>  <?php  } else {   // leave page alone } ?> 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -