I want to redirect to another page after inserting values in the database, but it is not redirecting. It remains on the same page. No error/warning is shown.
My code:
<?php
if (isset($_POST['btn-submit'])) {
$asth = $user->runQuery("SELECT MAX(Sr) as Sr FROM answer");
$asth->execute();
$aresult = $asth->fetch(PDO::FETCH_ASSOC);
$atf = ($aresult['Sr']);
$aI = "1";
$acid = $atf + $aI;
$arn = $fddate.$ydate.$mdate.$frandno.$acid;
$count = $i;
for ($j = 1; $j <= $count; $j++) {
$ufname = trim($_POST['radio'.$j]);
$Qrn = trim($_POST['qid'.$j]);
$istmt = $user->runQuery("INSERT INTO answer(ARN,Ans,QRN,SRN) VALUES(:user_arn, :user_crn, :user_qrn, :user_srn)");
$istmt->bindparam(":user_qrn",$Qrn);
$istmt->bindparam(":user_crn",$ufname);
$istmt->bindparam(":user_arn",$arn);
$istmt->bindparam(":user_srn",$srn);
$istmt->execute();
}
return $istmt;
$locationei = "result.php";
$locatione = $web.$locationei;
$user->redirect($locatione);
}
?>
In the starting of page:
require_once 'class.user.php';
$user = new USER();
In class.user.php
:
public function redirect($url) {
header("Location: $url");
}