So i believe that automatic form submission is supposed to happen like this:
<form id="submit-me" ..... </form>
and then later....
<script type="text/javascript">
document.getElementById("submit-me").submit();
</script>
But for some reason, nothing happens when the page is loaded.
More specifically, the js script is only placed on the page if a particular PHP variable is equal to true. The next line of the PHP if statement immediately sets the variable back to false so that no looping occurs.
I am attaching a picture of the html that the PHP has rendered and I am circling the two parts that should be interacting but aren't. Theoretically, I should never be able to see this JS script and its form counterpart in the inspector because it would constantly be submitting, which means that the JS script isn't being triggered/ is not set up correctly. What do I need to do to trigger it and are there security issues that certain browsers like Chrome watch out for that prevent automatic form submission?
Actual code:
echo '<form id="mainform" method="post" action="/bryan/modtourney.php?mode='.$mode.'&recursion='.$recursion.'">';
I then add a big form and close it then a little later add this:
<?php
if ($_SESSION['autoexecute'] == true)
{
$_SESSION['autoexecute'] =false;
?>
<script type="text/javascript">
document.getElementById("mainform").submit();
</script>
<?php
}
?>
There are console errors.