Need help in handling data and populating:
I am creating Employee database, there are two pages:
1. Add Employee
2. Modify Employee
Add Employee, takes inputs like EMP Name, EMP ID, Manager name (drop downlist), Location (radio option of them is selected)
All these inputs are written in to the database.
Employee 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>
In Modify Employee page, based on the emplyee ID, I want to render the page with values from db to the html page.
I am using the similar page to modify the entries. I am able to display text field by value=$EMPID. How do I do the same for dropdown list and checkbox?
Employee 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>
Can you please help me.
Basically I am coming up with Modify Page, which would retrieve data from db and display in the HTML form.Below code did not help to display the selected value:
<?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>
How do I resolve it?
Below resolved the issue: