User's Manual
Building the Basic Employee Form
Beta Draft Querying Data 4-13
require('anyco_ui.inc');
session_start();
construct_employees();
...
?>
3. Edit anyco_ui.inc. Implement the presentation of employee data in a HTML
table by adding a ui_print_employees() function:
function ui_print_employees($employeerecords)
{
if (!$employeerecords) {
echo '<p>No Employee found</p>';
}
else {
echo <<<END
<table>
<tr>
<th>Employee<br>ID</th>
<th>Employee<br>Name</th>
<th>Hiredate</th>
<th>Salary</th>
<th>Commission<br>(%)</th>
</tr>
END;
// Write one row per employee
foreach ($employeerecords as $emp) {
echo '<tr>';
echo '<td align="right">'.
htmlentities($emp['EMPLOYEE_ID']).'</td>';
echo '<td>'.htmlentities($emp['EMPLOYEE_NAME']).'</td>';
echo '<td>'.htmlentities($emp['HIRE_DATE']).'</td>';
echo '<td align="right">'.
htmlentities($emp['SALARY']).'</td>';
echo '<td align="right">'.
htmlentities($emp['COMMISSION_PCT']).'</td>';
echo '</tr>';
}
echo <<<END
</table>
END;
}
}
4. Save the changes to anyco.php and anyco_ui.inc. Test the result of these
changes by entering the following URL in your Web browser:
http://localhost/~<username>/chap4/anyco.php
Examine the result page, and scroll down to view all the employee rows displayed
in the page: