javascript - Auto click function continuously clicking on submit button -


i have put auto click function on form. want auto click submit button once. code continuously clicking on submit button. due page continuously auto reloading.

i want click once on button. how can that?

<form action="" method="post">         <input type="text" size="80" name="url"  value="https://drive.google.com/file/d/<?php echo $_get['id']; ?>/view"/>         <input type="submit" id="btn" value="play" name="submit" />     </form>  <script> window.onload = function(){ document.getelementbyid('btn').click(); } </script> 

the 2 answers given good, users can manipulate , mess these stored session items , therefore allows manipulation of validation.

to avoid users messing validation can check if form has been posted in php. important when dealing sensitive user information.

<?php if(!isset($_post['submit'])) { ?> <script>    window.onload =  function ()     {         document.getelementbyid('btn').click();          } </script> <?php } ?> 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -