【发布时间】:2014-11-12 00:11:29
【问题描述】:
我有一个包含字段名称和性别的表格。我得到数据并尝试在输入字段中显示信息,它适用于输入文本名称,但我想知道是否可以根据从表中获得的数据检查单选按钮?
<?php
$sql="select * from empleo where id='$id';";
if (!mysqli_query($con,$sql)) {
die('Error: ' . mysqli_error($con));}
$cs=mysqli_query($con,$sql);
while($resul=mysqli_fetch_array($cs)){
$name=$resul[0];
$sexo=$resul[1];
}
?>
Name: <input type="text" value="<?php echo $name?>"/><br>
<label for="radio">Hombre</label>
<input type="radio" name="gender" id="radio" value="men">
<label for="radio" > Mujer</label>
<input type="radio" name="gender" id="radio" value="women">
【问题讨论】: