Why does my code didn't work ? please help me ,,, thank you


#1
<?php if (isset($_POST['submit'])) { include "db.php"; $idnum =$_POST['idnum']; $sql = "SELECT * FROM studaccount WHERE Id_Number = '$idnum' "; $result = $conn->query($sql); ob_start(); if (!$row = $result->fetch_assoc()) { header("Location: portal.php?com=1"); } else{ if ($idnum == $row['Id_Number']) { $fname = $row['Firstname']; $mname = $row['Middlename']; $lname = $row['Lastname']; $picc = $row['Pic']; $course = $row['Course']; $section = $row['Section']; $semester = $row['Semester']; header("Location: acc.php?idnum=$idnum&fname=$fname&mname=$mname&lname=$lname&pic=$picc&course=$course&section=$section&sem=$semester"); } ob_end_flush(); } } ?>

#2

Hello! Please explain what isn’t working. Thanks!