<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="bootstrap-4.6.2-dist/css/bootstrap.min.css">
</head>
<body>
    
     <div class="row">
        <div class="col-md-3"></div>
        <div class="col-md-6">
            <form action="biodata form.php" method="POST">
                <div class=" row form-group">
                <div class="col-md-6">
                    <label for="name"> Full name</label>
                    <input type="text" name="fname" class="form-control">
                </div>
                <div class="col-md-6">
                    <label for="name">Mat No.</label>
                    <input type="text" name="mat" class="form-control">    
                </div>
            </div>
            <div class=" row form-group">
                <div class="col-md-6">
                    <label for="name"> Program type</label>
                   <select name="program" id="" class="form-control">
                    <option value="name1">select program type</option>
                    <option value="name1">ND Full time</option>
                    <option value="name1">ND part time</option>
                   </select>
                </div>
                <div class="col-md-6">
                    <label for="name">Session</label>
                   <select name="sessiond" id="" class="form-control">
                    <option value="name1">Select session</option>
                    <option value="name1">2022/2023</option>
                    <option value="name1">2023/2024</option>
                   </select>   
                </div>
            </div>
            <div class=" row form-group">
                <div class="col-md-6">
                    <label for="name">School</label>
                   <select name="school" id="" class="form-control">
                    <option value="name1">Select School</option>
                    <option value="name1">Science</option>
                    <option value="name1">Management</option>
                    <option value="name1">Engineering</option>
                   </select>
                </div>
                <div class="col-md-6">
                    <label for="name">Department:</label>
                   <select name="Dept" id="" class="form-control">
                    <option value="name1">Select Department</option>
                    <option value="name1">Computer Science</option>
                    <option value="name1">Business Administration</option>
                    <option value="name1">Computer Engineering</option>
                    <option value="name1">Electrical Electronics Engineering</option>
                   </select>   
                </div>
            </div>
            <div class=" row form-group">
                <div class="col-md-6">
                    <label for="name">Level:</label>
                   <select name="leveld" id="" class="form-control">
                    <option value="name1">Select Level</option>
                    <option value="name1">ND1</option>
                    <option value="name1">ND2</option>
                   </select>
                </div>
                <div class="col-md-6">
                    <label for="name">Sex</label>
                   <select name="sex" id="" class="form-control">
                    <option value="name1">Select</option>
                    <option value="name1">Male</option>
                    <option value="name1">Female</option>
                    
                   </select>   
                </div>
            </div>
            <div class=" row form-group">
                <div class="col-md-6">
                    <label for="name">DOB</label>
                    <input type="date" name="dob" class="form-control">
                </div>
                <div class="col-md-6">
                    <label for="name">Email</label>
                    <input type="email" name="email" class="form-control">    
                </div>
            </div>
            <div class=" row form-group">
                <div class="col-md-6">
                    <label for="name">Phone</label>
                    <input type="text" name="phone" class="form-control">
                </div>
                <div class="col-md-6">
                    <label for="name">Residential Address</label><br>
                   <textarea cols="33" name="addressd" class="form-control"></textarea>
                </div>
            </div>
            <div class=" row form-group">
                <div class="col-md-6">
                    <label for="name">Place of Birth</label>
                    <input type="text" name="pbirth" class="form-control">
                </div>
                <div class="col-md-6">
                    <label for="name">State of Origin</label>
                    <input type="text" name="sorigin" class="form-control">    
                </div>
            </div>
            <div class=" row form-group">
                <div class="col-md-6">
                    <label for="name">Local Government</label>
                    <input type="text" name="lgovt" class="form-control">
                </div>
                <!-- <div class="col-md-6">
                    <label for="name">Parent Name</label>
                    <input type="text" name="pname" class="form-control">    
                </div> -->
            </div>
            <div class=" row form-group">
                <div class="col-md-6">
                    <label for="name">Parent/Guardian Name</label>
                    <input type="text" name="pgname" class="form-control">
                </div>
                <div class="col-md-6">
                    <label for="name">Parent/Guardian Phone number</label>
                    <input type="text" name="pgnumb" class="form-control">    
                </div>
            </div>
            <button type="submit" name="submit" class="btn-success">Submit</button>
            </form>
            
        </div>
        <div class="col-md-3"></div>
     </div>
    
</body>
</html>
<?php
$db=mysqli_connect("localhost","root","","studentportal");
if(mysqli_connect_errno()){
    echo "error connecting to database". mysqli_connect_errno();
}
if(isset($_POST['submit'])){

//initialize your variable
$fname=$_POST['fname'];
$mat=$_POST['mat'];
$program=$_POST['program'];
$sessiond=$_POST['sessiond'];
$school=$_POST['school'];
$Dept=$_POST['Dept'];
$leveld=$_POST['leveld'];
$sex=$_POST['sex'];
$dob=$_POST['dob'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$addressd=$_POST['addressd'];
$pbirth=$_POST['pbirth'];
$sorigin=$_POST['sorigin'];
$lgovt=$_POST['lgovt'];
$pgname=$_POST['pgname'];
$pgnumb=$_POST['pgnumb'];

$query ="INSERT INTO portal(fname,mat,program,sessiond,school,Dept,leveld,sex,dob,email,phone,addressd,pbirth,sorigin,lgovt,pgname,pgnumb) 
VALUES('$fname','$mat','$program','$sessiond','$school','$Dept','$leveld','$sex','$dob','$email','$phone','$addressd','$pbirth','$sorigin','$lgovt','$pgname','$pgnumb')";
$query_result= mysqli_query($db, $query);
if($query_result){
    echo "resgistration successful";
}else{
    echo "not successful";
}
}
?>