How to display echo if user has not selected from a drop down menu

前端 未结 2 334
面向向阳花
面向向阳花 2021-01-25 05:11

In my code below I have 2 drop down menus. One is a \"Course\" drop down menu and the other is a \"Modules\" drop down menu:

Below is the code:

   

        
2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-25 06:08

    Change your form tag

    to

    
    

    It's a good idea to validate on serverside too, just add a little code in your existing PHP if you want to check values on serverside:

    prepare($sessionquery);
    // You only need to call bind_param once
    $sessionqrystmt->bind_param("si",$moduleId,$userid);
    // get result and assign variables (prefix with db)
    
    $sessionqrystmt->execute(); 
    
    $sessionqrystmt->bind_result($dbSessionId,$dbSessionDate,$dbSessionTime, $dbModuleId, $dbTeacherId);
    
    $sessionqrystmt->store_result();
    
    $sessionnum = $sessionqrystmt->num_rows();   
    
    if($sessionnum ==0){
    echo "

    Sorry, You have No Sessions under this Module

    "; }

提交回复
热议问题