单击一个特定的单选按钮或选择选项后,我想添加一个文本输入
我有一个表单,其中有两个部分,其中单击“Sonstiges”(德语为“其他”)应该显示或添加附加文本输入,用户可以在其中为自己添加一些内容我找不到解决方案。我能找到的唯一方法是通过 ajax 添加动态输入量。但为此,我只需要一个固定数量。所以我想知道是否有更简单或更优雅的方法。
应该发生的地方
<h2>Problem & Geräteauswahl</h2>
<?php
//Einbinden der Datenbankverbindung
include 'dbconfig.php';
//Auslesen aller Gerätetypen
$query = $db->query("SELECT * FROM typ ORDER BY name ASC");
//Auslesen der Zeilen
$rowCount = $query->num_rows;
?>
<label for='gtyp'> Gerätetyp:
<select name = 'gtyp' id = 'gtyp'>
<option>Bitte Auswählen</option>
<?php
if($rowCount > 0){
while($row = $query->fetch_assoc()){
echo '<option value="'.$row['typ_ID'].'">'.$row['name'].'</option>';
}
} else{
echo '<option>Wenn sie das sehen, hat Chris seinen Job nicht gut gemacht</option>';
}
?>
<option>Sonstiges</option>
</select>
</label>
<br>
<label for = 'hers'> Hersteller:
<select name = 'hers' id= 'hersteller'>
<option>Bitte Gerätetyp wählen</option>
</select>
</label>
<br>
<label for = 'ger'> Gerätebezeichnung:
<select name = 'ger' id= 'geraet'>
<option>Bitte Hersteller wählen</option>
</select>
</label>
<br>
Add Testfield here
<br>
蝴蝶不菲