组合框中的数据用数据库中的数据填充

function dropDownStudent()
{
    $connect = connect();
    $sql = "SELECT lastname, firstname, middleinitial FROM student";
    $sql_connect = mysqli_query($connect, $sql);
}

<?php
include("process.php");

?>

<?php
            $result = dropDownStudent();
            while($row=mysqli_fetch_array($result, MYSQL_ASSOC)){?>
            <select name = "stud" required>
                <? echo "<option> value='".$row['id']"'>" . $row['lastname'] . "," . $row['firstname'] . " " . $row['middleinitial'] . "</option>";?>
            </select>
            <?php
            }

?>

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in C:\xampp\htdocs\capstoneegisterstudent.php on line 11

i dont know why this is my error. i donw know my parameter 1 is null

In your Function you nee to return the result. Otherwise $result will be null and therefor mysqli_fetch_array won't work.

function dropDownStudent()
{
    $connect = connect();
    $sql = "SELECT lastname, firstname, middleinitial FROM student";
    return  mysqli_query($connect, $sql); // You did this wrong
}

to further improve it, you shouldn't to the connect in the function:

$connect = connect();
function dropDownStudent()
{
    global $connect;
    $sql = "SELECT lastname, firstname, middleinitial FROM student";
    return  mysqli_query($connect, $sql); // You did this wrong
}

Otherwise you will open a new connection everytime you use the function. This way it's only one connection at a time.