}
    exit(0);
}
switch ($_POST['submit']) {
    case 'clear_batch':
        $sql = 'delete from inquiry';
        $result = mysql_query($sql, $link);
        echo '<br>' . $sql . '::  Query Result: number of records deleted:' . mysql_affected_rows($link);
        break;
    case 'refresh':
        break;
    case 'send_batch':
        $counter = 0;
        echo '<br>batch sent:';
        $sql = 'select * from inquiry';
        $result = mysql_query($sql, $link);
        while ($array_inq = mysql_fetch_assoc($result)) {
            send_whole_sample_to_XL_640($array_inq['sample_id']);
            $counter++;
            sleep(1);
        }
        echo '(total ' . $counter . ')';
        break;
}
echo '<br>current batch:(total=';
$sql = 'select * from inquiry';
$result = mysql_query($sql, $link);
echo mysql_num_rows($result) . ')';
while ($array_res = mysql_fetch_assoc($result)) {
    echo $array_res['sample_id'] . ',';
}
echo '<tr>';
echo '<td>';
echo '<table border=1>';
echo '<th colspan=4><font color=green>Send Sample to XL-640 worklist</font></th>';
echo '<form method=post action=\'send_sample_to_XL_640.php\'>';
echo '<td><input type=hidden name=sample_id value=\'' . $sample_id . '\'></td>';
echo '<tr>';
echo '<td><input type=submit value=prev name=submit ></td>';
echo '<td><input type=submit value=next name=submit ></td>';
echo '<td><input type=submit value=go_to name=submit ></td>';
echo '<td><input type=submit value=send_to_XL name=submit ></td></tr>';
echo '<tr><td colspan=4><input type=text name=sample_id value=\'' . $sample_id . '\'></td></tr>';
echo '</form>';
echo '</table>';
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td valign=top>';
print_sample_worklist($sample_id);
echo '</td>';
echo '<td>';
//send_whole_sample_to_LIS($sample_id);
if (isset($_POST['submit']) && isset($_POST['sample_id'])) {
    if ($_POST['submit'] == 'send_to_XL') {
        //$sample_id=$_POST['sample_id'];
        send_whole_sample_to_XL_640($sample_id);
    }
}
echo '</td>';
echo '</tr>';
echo '</table>';