Home >Backend Development >PHP Tutorial >php-PHP if and else are both executed
php
require_once 'jiaowu.php';
$jwid=$_POST['jwid'];
$jwpw=$_POST['jwpw'];
$jwsc=$_POST['jwsc '];
$isLogin = getLogin($jwid,$jwpw,$jwsc);
if ($isLogin=="yes") {
session_start();
$xuenia = getXueNian($jwid);
$ scoreArry = array();
<code>for ($i=0; $i < count($xuenia); $i++) { //每个学年两个学期 $scoreArry[] = get_td_array(getGrade($jwid,$xuenia[$i],"1"),"1"); $scoreArry[] = get_td_array(getGrade($jwid,$xuenia[$i],"2"),"2");}// $s=getGrade($jwid,$xuenia[$i],"2");// $_SESSION['name']=getName($s);// $_SESSION['college']=getCollege($s);$_SESSION['course']=getcoursecontent(getcourse($jwid));$_SESSION['score']=$scoreArry;Header("Location:show.php"); </code>
}else{
session_start();
$_SESSION['error']="errorLogin";
header("Location:index.php");
}
?>
No error reported? You removed the session start in else