$other_wheree = $other_wheree . ' ' . $key . ' like \'' . $value . '\' and';
    }
}
$other_where = substr($other_wheree, 0, -3);
if (strlen($sample_id_where) > 0 && strlen($other_where) > 0) {
    $search_str = $search_str . ' where ' . $sample_id_where . ' and ' . $other_where;
} elseif (strlen($sample_id_where) > 0 && strlen($other_where) == 0) {
    $search_str = $search_str . ' where ' . $sample_id_where;
} elseif (strlen($sample_id_where) == 0 && strlen($other_where) > 0) {
    $search_str = $search_str . ' where ' . $other_where;
}
$printed = array();
if (isset($_POST['submit']) && substr($search_str, -7) != 'sample ') {
    $link = start_nchsls();
    if (!($search_result = mysql_query($search_str, $link))) {
        echo mysql_error();
    }
    while ($ar = mysql_fetch_assoc($search_result)) {
        $printed[] = $ar['sample_id'];
    }
    foreach ($printed as $value) {
        if (get_sample_status($value) != 'verified') {
            echo $value . ' is not verified. PDF report can not be printed<br>';
        }
    }
    print_report_pdf_A4($printed, $_POST['authorized_signatory']);
} else {
    main_menu();
    search_form('print_report_pdf_A4.php');
    echo '<h1>No coditions are given for selecting records</h1>';
}
            if (isset($_POST['authorized_signatory'])) {
                if (strlen($_POST['authorized_signatory']) == 0) {
                    echo '<h4>No authorized Signatory given</h4>';
                    //main_menu();
                    exit(0);
                }
            }
            $temp_list_of_sample = explode("|", $list_of_sample);
            $final_list_of_sample = array();
            foreach ($temp_list_of_sample as $value) {
                if (is_str_digit($value) !== FALSE) {
                    if (in_array($value, $final_list_of_sample) === FALSE) {
                        $final_list_of_sample[] = $value;
                    }
                }
            }
            foreach ($final_list_of_sample as $value) {
                if (get_sample_status($value) != 'verified') {
                    echo $value . ' is not verified. PDF report can not be printed<br>';
                    exit(0);
                }
            }
            //print_r($final_list_of_sample);
            print_report_pdf_A4($final_list_of_sample, $_POST['authorized_signatory']);
        }
    }
} else {
    main_menu();
    search_form($list_of_sample);
    echo '<h1>No coditions are given for selecting records</h1>';
}