HTML中的值属性未显示预期输出

时间:2018-01-25 05:12:05

标签: php html

<form>
    <?php
    $mis = '111503062';
    $db = new DB();
    $query = "SELECT * from Extracurricular where MIS =".$mis;
    $result = $db->run_query($query);
    $data1 = mysqli_fetch_array($result);
    echo $data1['Activities'];
    echo '<div class="form-group">
        <label for="exampleFormControlTextarea1">Extracurricular Activities</label>
        <textarea class="form-control" id="exampleFormControlTextarea1" rows="3" value='.$data1['Activities'].'></textarea>
    </div>'
    ?>
</form>

上面的echo语句有效,但为什么value属性在下面的文本框中没有显示相同的数据。

3 个答案:

答案 0 :(得分:2)

Textarea没有使用值来设置它的值,而是将其设置在每个<textarea>标记内:

echo '<div class="form-group">
    <label for="exampleFormControlTextarea1">Extracurricular Activities</label>
    <textarea class="form-control" id="exampleFormControlTextarea1" rows="3" >'.$data1['Activities'].'</textarea>
</div>'

答案 1 :(得分:1)

>>> door_numbers = [] >>> counts = {} >>> for el in room_numbers: ... count = counts.get(el, 0) ... c = string.ascii_uppercase[count] ... counts[el] = count + 1 ... door_numbers.append("{}.{}".format(el, c)) ... >>> door_numbers ['101.A', '103.A', '101.B', '102.A', '104.A', '105.A', '106.A', '107.A', '102.B', '108.A'] 值位于代码内容中,而不是textarea参数。

value

答案 2 :(得分:0)

你应该注意textarea。 Textarean的使用如下。

<form>
    <?php
    $mis = '111503062';
    $db = new DB();
    $query = "SELECT * from Extracurricular where MIS =".$mis;
    $result = $db->run_query($query);
    $data1 = mysqli_fetch_array($result);
    echo $data1['Activities'];
    echo '<div class="form-group">
        <label for="exampleFormControlTextarea1">Extracurricular Activities</label>
        <textarea class="form-control" id="exampleFormControlTextarea1" rows="3">'.$data1['Activities'].'</textarea>
    </div>'
    ?>
</form>