Populate more than one drop down using the same mysql query

前端 未结 3 672
礼貌的吻别
礼貌的吻别 2021-01-25 07:14

I have form with a number of drop boxes which have the numbers 1-5 in them. I can use this code to populate a drop down but was wondering if I can somehow only make the call to

3条回答
  •  北荒
    北荒 (楼主)
    2021-01-25 07:20

    You could store the data into an array, and then print the data by enumerating the array.

    $risks = array();
    
    // Load values into array.
    while ($row = $result->fetch_assoc()) {
        array_push($row['riskNumDrop']);
    }
    
    
    // Drop down #1
    echo '';
    
    // Drop down #2
    echo '';
    

提交回复
热议问题