I have two files.
a HTML form like so:
<form action="resubmitWithPHP.php" method="POST">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<input type="submit" name=submitButton value="Submit">
</form>
where user inputs thier details and after clicking submit get transfered to 'resubmitWithPHP.php'
where this script is waiting is:
<?php
if(isset($_POST['submitButton']))
{
$firstName = $_POST['fname'];
$lastName = $_POST['lname'];
?>
<form action="otherPage.php" method="POST">
<label for="fname">First name:</label>
<input type="hidden" id="fname" name="fname" value="<?php echo $firstName; ?>"><br><br>
<label for="lname">Last name:</label>
<input type="hidden" id="lname" name="lname" value="<?php echo $lastName; ?>"><br><br>
<input type="submit" name=submitButton value="Submit">
</form>
<?php
}
else
{
header("Location: ../goBack.php?sent=nope");
}
?>
My question is, how do I get this new form to submit without any further interaction from the user? I want the page to automatically submit the form as soon as it is possible to do so. Preferably without loading or displaying anything.