在处理数据和填充方面需要帮助:
我正在创建员工数据库,有两个页面:1.添加员工2.修改员工
添加员工,接受 EMP 名称、EMP ID、经理姓名(下拉列表)、位置(选择它们的单选选项)等输入。所有这些输入都写入数据库。
员工ID <div class="fb-input-number">
<input id="item12_number_1" name="emp_number" min="0" max="999999999" autocomplete="off" data-hint="" required="" step="1" type="number">
</div>
</div>
<select id="item13_select_1" name="Manager" data-hint="">
<option id="item13_0_option" value="Tom" >
TOM
</option>
<option id="item13_1_option" value="Harry" selected="selected">
HARRY
</option>
</select>
<label id="item16_0_label">
<input id="item16_0_radio" checked="checked" name="radio_location" data-hint="" value="IND" type="radio">
<span id="item16_0_span" class="fb-fieldlabel">
INDIA
</span>
</label>
<label id="item16_1_label">
<input id="item16_1_radio" name="radio_location" value="EMEA" type="radio">
<span id="item16_1_span" class="fb-fieldlabel">
EMEA
</span>
</label>
在“修改员工”页面中,基于员工 ID,我想将具有 db 值的页面呈现到 html 页面。我正在使用类似的页面来修改条目。我可以通过 value=$EMPID 显示文本字段。我如何为下拉列表和复选框做同样的事情?
员工ID <div class="fb-input-number">
<input id="item12_number_1" name="emp_number" min="0" max="999999999" autocomplete="off" data-hint="" required="" step="1" type="number" value="11222">
</div>
</div>
<select id="item13_select_1" name="Manager" data-hint="">
<option id="item13_0_option" value="Tom" >
TOM
</option>
<option id="item13_1_option" value="Harry" selected="selected">
HARRY
</option>
</select>
<label id="item16_0_label">
<input id="item16_0_radio" name="radio_location" data-hint="" value="IND" type="radio">
<span id="item16_0_span" class="fb-fieldlabel">
INDIA
</span>
</label>
<label id="item16_1_label">
<input id="item16_1_radio" name="radio_location" value="EMEA" type="radio" checked="checked">
<span id="item16_1_span" class="fb-fieldlabel">
EMEA
</span>
</label>
你能帮我么。
基本上我想出了修改页面,它将从数据库中检索数据并显示在 HTML 表单中。下面的代码无助于显示选定的值:
<?php
mysql_connect($SERVER_IP, $USERNAME, $PWD) or die(mysql_error());
mysql_select_db($DBNAME) or die(mysql_error());
$result=mysql_query("SELECT * from `Data` where Emp_ID = $MyEmpID ");
$info = mysql_fetch_array( $result );
$Location=$info['Location'];
?>
<html>
<body>
<div class="fb-dropdown">
<select id="item13_select_1" name="location" data-hint="">
<option id="item13_0_option" value="BLR" <? if ($Location=="BLR") echo "selected"; ?> >
Bangalore
</option>
<option id="item13_1_option" value="EMEA" <? if ($Location=="EMEA") echo "selected"; ?> >
EMEA
</option>
</select>
</div>
</body>
</html>
我该如何解决?