表单完成并按下提交按钮后,我将重定向到下一页。此代码在 Windows 服务器上运行良好,但无法重定向到 linux 服务器上的下一页
<?php
include 'scripts/functions/init.php';
Restrict();
?>
<?php
$userid = $_SESSION['userid'];
if (empty($_POST)=== false)
{
$R_fields = array('OFO_Code','OFO_Title','Curr_Code','Curr_Title');
foreach($_POST as $key=>$value)
{
if (empty($value) && in_array($key,$R_fields)=== true)
{
$errors[] = 'fields marked with (*) are required';
break 1;
}
}
$_SESSION['Combo'] = $_SESSION['OFO_Code'].$_SESSION['Curr_Code'];
if(empty($errors)=== true)
{
if(Curr_Code_exists($_SESSION['Combo']))
{
$errors[] = 'Sorry, the Curriculum Code already exist, please use the edit function';
}
if(strlen('Curr_Code')<6)
{
$errors[] ='Curriculum Code must be at least 6 Characters';
}
}
}
?>
上面的代码出现在 html 之前,然后是表单。然后就在提交按钮之后遵循以下内容,它也位于内部
<?php
$_SESSION['OFO_Code'] = $_POST['OFO_Code'];
$_SESSION['Curr_Code'] = $_POST['Curr_Code'];
if(empty($_POST) === false && empty($errors)=== true)
{
//Capture data from the fields to an array
$Capture_Occupation_info = array(
'OFO_Code' => $_SESSION['OFO_Code'],
'OFO_Title'=>$_POST['OFO_Title'],
'Curr_Code'=>$_SESSION['Combo'],
'Curr_Title'=>$_POST['Curr_Title'],
'userid'=>$userid);
//Submit the data into the database
capture_occupation_info($Capture_Occupation_info);
header('Location:Capture_Menu.php');
exit();
}
else
{
//Display errors
echo output($errors);
}
?>