我尝试过使用ob_start();和exit(); ,两者都不起作用,请指教,非常感谢
<?php
ob_start();
// connect to the database
include('connect-db.php');
// check if the form has been submitted.
// If it has, start to process the form and save it to the database
// once saved, redirect back to the view page
if (isset($_POST["submit"]))
{
foreach ($_POST['patientid'] as $index => $patientid)
{
$id = mysql_real_escape_string($_POST['id'][$index]);
$data1 = mysql_real_escape_string($patientid);
$data2 = mysql_real_escape_string($_POST['vaccineid'][$index]);
$data3 = mysql_real_escape_string($_POST['vaccinename1'][$index]);
$data4 = mysql_real_escape_string($_POST['vaccinename2'][$index]);
$data5 = mysql_real_escape_string($_POST['vaccinename3'][$index]);
$data6 = mysql_real_escape_string($_POST['totalnoofinjection'][$index]);
$data7 = mysql_real_escape_string($_POST['nthinjection'][$index]);
$data8 = mysql_real_escape_string($_POST['date'][$index]);
$data9 = mysql_real_escape_string($_POST['nextdate'][$index]);
$data10 = mysql_real_escape_string($_POST['skip'][$index]);
$data11 = mysql_real_escape_string($_POST['language'][$index]);
mysql_query("UPDATE patientvaccinedetail SET patientid = '$data1',
vaccineid = '$data2', vaccinename1 = '$data3',
vaccinename2 = '$data4', vaccinename3 = '$data5',
totalnoofinjection = '$data6', nthinjection = '$data7',
date = '$data8', nextdate = '$data9', skip = '$data10',
language = '$data11'
WHERE id=$id") or die(mysql_error());
header("Location: start.php");
exit;
}
}
刚更新,仍然无法重定向到其他页面
答案 0 :(得分:3)
您在exit
更正后的代码:
exit;
答案 1 :(得分:1)
在标题调用之前使用ob_end_clean();
并使用exit;
代替exit
尝试如下
ob_end_clean();
header("Location: start.php");
exit;