function acco($cid, $bhawan, $room)
 {
     @session_start();
     $student = studentdetails($cid);
     if (count($student) == 1) {
         $con = dbconnect();
         mysqli_query($con, "UPDATE participant SET bhawan='{$bhawan}', room='{$room}' WHERE cogni_id='{$cid}'");
         $_SESSION['success'] = "Done";
     } else {
         $_SESSION['error'] = "Something went wrong";
         // header("location: resetpassword.php");
     }
 }
<?php

session_start();
$user = isset($_SESSION['user']);
if ($user == false) {
    header('location: ./login.php');
}
$activepage = "counter1";
include "./header.php";
$flag = 0;
if (isset($_POST['search'])) {
    $cid = $_POST['cogniid'];
    $participant = participantdetails($cid);
    if (@$participant[0]['last_counter'] <= 1) {
        $student = studentdetails($cid);
        $flag = count($student);
        if ($flag == 0) {
            $student = false;
        }
    } else {
        $_SESSION['error'] = "This Cogni ID is already passed from counter 1";
    }
}
if (isset($_POST['submit'])) {
    $cid = $_POST['cid'];
    $noc = $_POST['noc'];
    $registrationreceipt = $_POST['registrationreceipt'];
    $payment = $_POST['payment'];
    counter1($cid, $noc, $registrationreceipt, $payment);
}
?>