这是重定向页面代码
<?php
if(isset($_REQUEST['msg'])) {
echo base64_decode($_REQUEST['msg']);
}
?>
此代码在我的操作页面上运行
if (mysqli_query($dbcon,$sql)){
$msg=base64_encode('Successfully Registered');
//Redirection
if($msg!=""){
header("Location:../registration.php?msg=$msg");
exit();
}
} else{
$msg=mysqli_error($dbcon);
}
实际上,我的问题是现在错误消息正确显示在重定向页面中,但是此消息始终显示在重定向页面中。我刷新了该消息未显示的页面,但是我在注册页面中,然后我回到首页,再次回到注册页面,然后消息消失了。如何解决此错误,请帮助我放置
这是我操作页面中的完整代码
<?php
ob_start();
session_start();
$msg="";
include 'db_connection.php';
$fullname=$_POST['fullname'];
$address=$_POST['address'];
$email=$_POST['email'];
$nic=$_POST['nic'];
$telephone_no=$_POST['telephone_no'];
$loantype=$_POST['loantype'];
$bank=$_POST['bank'];
$amount=$_POST['amount'];
$plan_file=basename($_FILES["plan_file"]["name"]);
$payment_slip_url=basename($_FILES["payment_slip_url"]["name"]);
$date=date('Y-m-d H:i:s');
//$job_description_img_url = basename($_FILES["job_description_img_url"]["name"]);
$sql= "INSERT INTO user_register (fullname,address,email,nic,telephone_no,loantype,bank,amount,plan_file,payment_slip_url,dateposted) VALUES ('$fullname','$address','$email','$nic','$telephone_no','$loantype','$bank','$amount','$plan_file','$payment_slip_url',NOW())";
//slip add START
$folder = "payment_slip/";
$file = $folder.basename($_FILES["payment_slip_url"]["name"]);
//$success = move_uploaded_file($_FILES["payment_slip_url"]["tmp_name"],$file);
$ok=1;
$file_type=$_FILES['payment_slip_url']['type'];
if ($file_type=="image/png" || $file_type=="image/jpeg") {
if(move_uploaded_file($_FILES['payment_slip_url']['tmp_name'], $file))
{
echo "The file ". basename( $_FILES['payment_slip_url']['name']). " is uploaded";
}
else {
echo "Problem uploading file";
}
}
else {
echo "You may only upload JPEGs or PNG files.<br>";
//$msg=base64_encode("You may only upload JPEGs or PNG for Payment Slip");
}
//slip add END
//plan add START
$folder = "plans/";
$file = $folder.basename($_FILES["plan_file"]["name"]);
//$success = move_uploaded_file($_FILES["payment_slip_url"]["tmp_name"],$file);
$ok=1;
$file_type=$_FILES['plan_file']['type'];
if ($file_type=="application/pdf") {
if(move_uploaded_file($_FILES['plan_file']['tmp_name'], $file))
{
echo "The file ". basename( $_FILES['plan_file']['name']). " is uploaded";
}
else {
echo "Problem uploading file";
}
}
else {
//echo "You may only upload PDFs.<br>";
$msg=base64_encode("You may only upload PDFs for Plan Images");
}
//plan add END
if (mysqli_query($dbcon,$sql)){
//echo "OK";
//$msg=base64_encode("Successfully Registered");
$msg=base64_encode('Successfully Registered');
//}else{
//echo "NO";
//$msg=base64_encode("Please enter your details correctly");
//}
//Redirection
if($msg!=""){
header("Location:../registration.php?msg=$msg");
exit();
}
}
else{
$msg=mysqli_error($dbcon);
}
ob_end_flush();
?>