我希望有人可以提供帮助。 当我提交此脚本时,表单只刷新并且不显示thankyou.php页面。 谢谢你的帮助
include 'dbc.php';
$err = array();
if(@$_POST['doAcademic'] == 'Academic')
{
// This code filters harmful script code and escapes data of all POST data from the user submitted form.
foreach($_POST as $key => $value) {
$data[$key] = filter($value);
}
// Automatically collects the hostname or domain like example.com)
$host = $_SERVER['HTTP_HOST'];
$host_upper = strtoupper($host);
$path = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
这些将日期字段从HTML
连接在一起@$degree_date = date("Y-m-d", mktime(0,0,0,$dt,$mo,$yr));
@$other_degree_date = date("Y-m-d", mktime(0,0,0,$dty,$moy,$yry));
@$expd_degree_date = date("Y-m-d", mktime(0,0,0,$dti,$moi,$yri));
if(empty($err)) {
// inserts data into mysql table
$sql_insert = "INSERT into `acadmic`
(`otherapply`,`otherinstitute`,`institute`,`institute_city`,
`degree_country`, `degree_date`,`degree`,`grade`, `other_degree_institute`,
`other_degree_city`,`other_degree`, `other_degree_date`,`other_degree_grade`,
`expd_degree_institute`,`expd_degree_city`,
`expd_degree_country`, `expd_degree`,
`expd_degree_date`,`current_docyear_prog`,`current_docyear_funded`,
`prevfields`,`profexperience`
)
VALUES
('$data[otherapply]','$data[otherinstitute]','$data[institute]',
'$data[institute_city]',
'$data[degree_country]', '$degree_date', '$data[degree]', '$data[grade]',
'$data[other_degree_institute]' ,'$data[other_degree_city]', '$data[other_degree]',
'$other_degree_date', '$data[other_degree_grade]', '$data[expd_degree_institute]',
'$data[expd_degree_city]','$data[expd_degree_country]',
'$data[expd_degree]','$expd_degree_date','$data[current_docyear_prog]',
'$data[current_docyear_funded]',
'$data[prevfields]','$data[profexperience]'
)
";
mysql_query($sql_insert,$link) or die("Insertion Failed:" . mysql_error());
此代码将用户返回到thankyou页面。
header("Location: thankyou.php");
exit();
}
}
提前致谢
答案 0 :(得分:2)
我没有看到任何提及/加载/重定向到您的代码中的感谢页面。
另外我建议你的print_r你的$ sql_insert:
的print_r($ sql_insert);
在$ sql_insert赋值后的行上。
您可能还想检查数据库以查看是否正在插入行,如果不是,那么您知道您的问题是什么(您的sql),如果它正在插入那么您的问题就是其他地方和您需要发布你的其余部分。
我不确定这是不是一个错误,但是我在你的sql请求中看到你的表拼写为'acadmic':
INSERT into `acadmic`
在经验丰富的领域之后,你也有一个尾随:
,`profexperience`,)
VALUES
发布更多详情:)
答案 1 :(得分:0)
提交后我想你只想header('Location: thankyou.php'); exit;