}
if ($_POST["sort"]) {
    $_GET["sort"] = $_POST["sort"];
}
if ($_POST["storepapers"]) {
    $_POST["papers"] = $_POST["storepapers"];
}
//Call function to evaluate showing
$_GET["showing"] = evaluate_showing($_GET["showing"]);
if (isset($_GET["err"])) {
    $error_array["papers"][0] = "You must choose at least one paper before you can update<br>\n";
}
$num_rows = 0;
$i = 0;
$array = array();
if (($selectionSQL = setup_view_all_bids($num_rows, $GLOBALS["DB_PREFIX"], &$err_message)) !== NULL) {
    if ($num_rows > 0) {
        if (($selectionResult = limit_view_all_bids($selectionSQL, $_GET["sort"], $_GET["showing"], MAXRECORDS, &$err_message)) !== NULL) {
            while ($paperInfo = $selectionResult->FetchNextObj()) {
                //Get the lastest file of the paper
                if (($FileIDData = get_latestFileID($paperInfo->PaperID, &$err_message)) === false) {
                    do_html_header("View Paper Bids Failed", &$err_message);
                    $err_message .= " Could not execute \"get_latestFile\" in \"edit_paper_bids.php\". <br>\n";
                    $err_message .= "<br><br> Try <a href='" . $_SERVER["PHP_SELF"] . "?" . $_SERVER["QUERY_STRING"] . "'>again</a>?";
                    do_html_footer(&$err_message);
                    exit;
                }
                $array[$i]["paperid"] = $paperInfo->PaperID;
                $array[$i]["bidname"] = $paperInfo->PreferenceName;
                $array[$i]["fileid"] = $FileIDData->FileID;
                $array[$i]["papertitle"] = stripslashes($paperInfo->Title);
}
if ($_POST["sort"]) {
    $_GET["sort"] = $_POST["sort"];
}
if ($_POST["storepapers"]) {
    $_POST["papers"] = $_POST["storepapers"];
}
//Call function to evaluate showing
$_GET["showing"] = evaluate_showing($_GET["showing"]);
if (isset($_GET["err"])) {
    $error_array["papers"][0] = "You must choose at least one paper before you can update<br>\n";
}
$num_rows = 0;
$i = 0;
$array = array();
if (($selectionSQL = setup_view_all_bids($num_rows, $dbprefix, &$err_message)) !== NULL) {
    if ($num_rows > 0) {
        if (($selectionResult = limit_view_all_bids($selectionSQL, $_GET["sort"], $_GET["showing"], MAX_PAPERS, &$err_message)) !== NULL) {
            while ($paperInfo = $selectionResult->FetchNextObj()) {
                //Get the lastest file of the paper
                if (($FileIDData = get_latestFileID($paperInfo->PaperID, &$err_message)) === false) {
                    do_html_header("Bid Papers", &$err_message);
                    $err_message .= " Could not execute \"get_latestFile\" in \"bid_all_papers.php\". <br>\n";
                    $err_message .= "<br><br> Try <a href='" . $_SERVER["PHP_SELF"] . "?" . $_SERVER["QUERY_STRING"] . "'>again</a>?";
                    do_html_footer(&$err_message);
                    exit;
                }
                $array[$i]["paperid"] = $paperInfo->PaperID;
                $array[$i]["bidname"] = "Default bid - No preference indicated";
                $array[$i]["fileid"] = $FileIDData->FileID;
                $array[$i]["papertitle"] = stripslashes($paperInfo->Title);