ACTION FOR CHECK LIST OPERATION FAILED

HAI STEVE AND ALL,
This action is to get the service number from the user and then change SELECTED CHECKBOX loan holder to the loan holder entered in the form.
I have tried to do this by the following action but failed.
My code:
<?php
class actions_loan{
function handle(&$params){
if(isset($_POST['submit'])){
$app =& Dataface_Application::getInstance();
$query =& $app->getQuery();
$table = &Dataface_Table::loadTable($query['-table']);
$records =& df_get_selected_records($query);
$auth =&Dataface_AuthenticationTool::getInstance();
$user =& $auth ->getLoggedInUser();
$updated = 0; // Count the number of records we update
$errs = array(); // Log the errors we encounter
$service_no = $_POST['serno'];
foreach ($records as $rec){
$role = $user->val('Role');
if ( $role != 'ADMIN') {
$errs[] = Dataface_Error::permissionDenied(
"This type of approval is only for ADMIN'".
$rec->getTitle().
"' cannot be update. Action Denied by web master");
continue;
}
$rec->setValue('loan_holder',$service_no );
$res = $rec->save(true /*secure*/);
if ( PEAR::isError($res) ) $errs[] = $res->getMessage();
else $updated++;
}
}
echo '
<form action="http://111.11.11.11/www/index.php?-action=loan" enctype="application/x-www-form-urlencoded" method="post" >
<b>Enter Service no:</b><input name="serno" type = "number"/>
<input type="reset" name="Reset"/><input type="submit" value="submit" />
</form>';
}
}
THANKS FOR THE HELP
This action is to get the service number from the user and then change SELECTED CHECKBOX loan holder to the loan holder entered in the form.
I have tried to do this by the following action but failed.
My code:
<?php
class actions_loan{
function handle(&$params){
if(isset($_POST['submit'])){
$app =& Dataface_Application::getInstance();
$query =& $app->getQuery();
$table = &Dataface_Table::loadTable($query['-table']);
$records =& df_get_selected_records($query);
$auth =&Dataface_AuthenticationTool::getInstance();
$user =& $auth ->getLoggedInUser();
$updated = 0; // Count the number of records we update
$errs = array(); // Log the errors we encounter
$service_no = $_POST['serno'];
foreach ($records as $rec){
$role = $user->val('Role');
if ( $role != 'ADMIN') {
$errs[] = Dataface_Error::permissionDenied(
"This type of approval is only for ADMIN'".
$rec->getTitle().
"' cannot be update. Action Denied by web master");
continue;
}
$rec->setValue('loan_holder',$service_no );
$res = $rec->save(true /*secure*/);
if ( PEAR::isError($res) ) $errs[] = $res->getMessage();
else $updated++;
}
}
echo '
<form action="http://111.11.11.11/www/index.php?-action=loan" enctype="application/x-www-form-urlencoded" method="post" >
<b>Enter Service no:</b><input name="serno" type = "number"/>
<input type="reset" name="Reset"/><input type="submit" value="submit" />
</form>';
}
}
THANKS FOR THE HELP