将选定的下拉列表相关值放入文本框中

时间:2017-12-02 14:13:04

标签: php mysqli

我想在用户从数据库中选择指定下拉列表后生成薪水。 enter image description here

我的db结构如下:

employee:
 emp_id   dep_id  
   1        1
   2        1


designation:
 dep_id     des_name     salary
   1       accountant    20000

这是我的HTML代码:

<div class="form-group">
    <label class="control-label col-lg-2" for="initial">Designation :</label>
        <div class="col-lg-3">
            <select class="form-control input-sm" name="classification" id="classification" onchange="changeValue();"> 

                <?php while($row3 = mysqli_fetch_array($result3)):; ?>
                <option><?php echo $row3[2]; ?></option>
                <?php endwhile; ?>

            </select>
            <span class="error_form" id="classification_error_message"></span>
        </div>
    <label class="control-label col-lg-2" for="basicSalary">Basic Salary :</label>
    <div class="col-lg-3">
        <input type="text" class="form-control input-sm" name="basicSalary" id="basicSalary" placeholder="0.00">
    </div>
</div>

1 个答案:

答案 0 :(得分:0)

你可以使用这段代码从php codeigniter中获取此代码。现在你可以根据你的要求改变它。

    int count[] = new int[256];
    int len = str.length();
    for (int i=0; i<len; i++)
        count[str.charAt(i)]++;
    int max = -1;
    char result = ' ';

    for (int i = 0; i < len; i++) {
        if (max < count[str.charAt(i)]) {
            max = count[str.charAt(i)];
            result = str.charAt(i);
        }
    }
相关问题