Here is code whats wrong with it not working Note:: No error showing or redirect to print.php
$conn=mysqli_connect("localhost","root","","degree");
$sql="select * from students where regno=$regno";
$res= mysqli_query($conn,$sql);
if(mysqli_num_rows($res) >0)
{
echo "<script>alert('Student Already Exists')</script)" ;
}
else{
$query="INSERT into students (id,name,regno,program,fname,stcnic,phone,mobile,email,address,gender,gown,relname1,
relation1,relcnic1,relname2,relation2,relcnic2,gust1,guestrel1,guestcnic1,guest2,guestrel2,guestcnic2)
values('','$name',$regno,'$program','$fname','$stcnic',$phone,$mobile,'$email','$address','$gender','$gown','$relname1',
'$relation1','$relcnic1','$relname2','$relation2','$relcnic2','$guest1','$guestrel1','$guestcnic1','$guest2','$guestrel2','$guestcnic2')";
$result=mysqli_query($conn,$query);
if($result)
{
$_SESSION['id']=$regno;
header("location:print.php");
}
}