I am trying to make a page redirect after it sends form data to my MySQL server.
The following try and catch loop executes an array I have set and sends it to the MySQL database.
if(!empty($_POST)) {
try {
$stmtCE = $dbMain->prepare($queryCE);
$resultCE = $stmtCE->execute($query_paramsCE);
echo "<meta http-equiv='refresh' content='0;url=mypage.php'>";
}
catch(PDOException $exCE) {
die("Failed to run query: " . $exCE->getMessage());
}
}
I chose to use the meta redirect, because I have had issues in the past with header() due to echoing out some other code to the page.
Using this code, my form submits to the MySQL database correctly, but fails to redirect after clicking the submit button. Are there any possible solutions to this problem?