I try to do a web page that contains a dropdown.
When dropdown is selected, I want to update the mark into MySQL database based on Enum, but the code does not work.
I use javascript with PHP to query into MySQL.
<form  id="myForm" method="post" onsubmit="return submitform()">
    <select id="lvl" name="lvl" style="height:30px;">    
            
        <option value="std1"selected="selected">
            <?php echo $stu1name["Stu_name"] ?>
        </option>
        <option value="std2" >  
            <?php echo $stu2name["Stu_name"] ?>
        </option>
        <option value="std3" >
            <?php echo $stu3name["Stu_name"] ?>
        </option>
        <option value="std4" >
            <?php  echo $stu4name["Stu_name"] ?>
        </option>
        <option value="std5" >
            <?php  echo $stu5name["Stu_name"] ?>
        </option>
                                        
    </select>
    <p><input type="submit" name="submit" value="Submit"></p>
</form>
This is my javascript with PHP:
function submitform() {
    var option= document.getElementById('lvl').value;
    if (option == "std1"){
        ?php
            mysqli_query($conn, 
                "UPDATE evaluation set mid_mark='" . $_POST["mid_mark"] . 
                "',end_mark='" . $_POST["end_mark"] . 
                "', performance='" . $_POST["performance"] . 
                "' WHERE Enum ='1'"
            ); 
        ?>
        return true;
    }
    if (option == "std2"){
        <?php
            mysqli_query($conn, 
                "UPDATE evaluation set mid_mark='" . $_POST["mid_mark"] . 
                "',end_mark='" . $_POST["end_mark"] . 
                "', performance='" . $_POST["performance"] . 
                "' WHERE Enum ='2'"
            ); 
        ?>
        return true;
    }   
    if (option == "std3"){
        <?php
            mysqli_query($conn, 
                "UPDATE evaluation set mid_mark='" . $_POST["mid_mark"] . 
                "',end_mark='" . $_POST["end_mark"] . 
                "', performance='" . $_POST["performance"] . 
                "' WHERE Enum ='3'"
            ); 
        ?>
        return true;
    }   
    if (option == "std4"){
        <?php
            mysqli_query($conn, 
                "UPDATE evaluation set mid_mark='" . $_POST["mid_mark"] . 
                "',end_mark='" . $_POST["end_mark"] . 
                "', performance='" . $_POST["performance"] . 
                "' WHERE Enum ='4'"
            ); 
        ?>
        return true;
    }
    if (option == "std5"){
        <?php
            mysqli_query($conn, 
                "UPDATE evaluation set mid_mark='" . $_POST["mid_mark"] . 
                "',end_mark='" . $_POST["end_mark"] . 
                "', performance='" . $_POST["performance"] . 
                "' WHERE Enum ='5'"
            ); 
        ?>
        return true;
    }       
}
but when I update, all the row is updated like this image
I don't know where I'm doing wrong here. I'm completely lost here.
 
     
    