0

hey can anyone help me

I would like to automatically submit the form on page load is there anyway it could be done?

<form method='post' action='/delete-account.php'>
<input type="submit" id="submit" name="submit" value="Confirm Account Removal" /></form>

2 Answers2

0
<form method='post' name="myForm" id="myForm"  action='/delete-account.php'>
<input type="submit" id="submit" name="submit" value="Confirm Account Removal" /></form>

 window.onload=function(){
          document.forms["myForm"].submit();
 }
Siva Ganesh
  • 1,415
  • 2
  • 16
  • 28
0

You can submit this way by using the jquery

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
       document.getElementById("myDataForm").submit();
});
</script>
</head>
<body>
<form method='post' id="myDataForm" name="myDataForm" action='/delete-account.php'>
<input type="submit" id="submit" name="submit" value="Confirm Account Removal" /></form>
</body>
</html>

Please try this.

Pranav MS
  • 2,235
  • 2
  • 23
  • 50