0

I have this on my PHP page:

<script>
window.setTimeout(function() {
    document.getElementById('test_form').submit();
}, 5000);
</script>

And it's working fine.

But when I'm placing this:

<input type="submit" name="submit" id="submit">Submit</input>

the JavaScript timer is not working. When I remove this, JavaScript works all fine. What's the problem and how it will be resolved?

Felix Kling
  • 795,719
  • 175
  • 1,089
  • 1,143
user2553342
  • 43
  • 2
  • 7

1 Answers1

1

try changing name of your submit button like,

<input type="submit" name="submit_btn" id="submit_btn">Submit</input>

Because when you name your button submit, you override the submit() function on the form.

IT ppl
  • 2,626
  • 1
  • 39
  • 56