I am trying to print a table of reviews based on the date they were written.
I set the dates and hit search and nothing happens? There are record in the database. Any help would be appreciated!

<?php
include_once("includes/session.php");
confirm_logged_in();
include_once("../includes/functions.php");
include("../includes/dbopen.php");
include("../includes/mysql.php");
?>
<?php
$pageTitle = 'List Orders';
$pageSubTitle='Orders';
include_once("includes/header_sidebar.php");

$message = "";
$logincount = 1;
$new = 1;
$errors = 0;
$errors_array = array();
$scrolltobottom = "";

//initialise screen fields
$selected_member = "";
$id = "";
$username = ""; $username_original = "";
$password = ""; $password_original = "";
$password_test = "";
$title = "MR"; $first_name = ""; $last_name = ""; $company_name = "";
$address1 = ""; $address2 = ""; $town = ""; $county = ""; $country = ""; $postcode = ""; $phone = ""; $mobile = ""; $email = "";
$member_confirmed = "N";
$ast_first = 0; $ast_last = 0; $ast_company = 0; $ast_add1 = 0; $ast_add2 = 0; $ast_town = 0; $ast_county = 0; $ast_country = 0; $ast_post = 0; $ast_phone = 0;
$ast_mobile = 0; $ast_email = 0;
$ast_user = 0; $ast_pass = 0; $ast_passconf = 0;

if(isset($_REQUEST['from_date']) and isset($_REQUEST['to_date'])){
    //date is returned as yyyy-mm-dd
    $from_date = $_REQUEST['from_date'];
    $strDate = explode("-", $from_date);
    $fday = $strDate[2]; $fmonth = $strDate[1]; $fyear = $strDate[0];
    $to_date = $_REQUEST['to_date'];
    $strDate = explode("-", $to_date);
    $tday = $strDate[2]; $tmonth = $strDate[1]; $tyear = $strDate[0];
}else{
    //default date
    $today = strftime("%Y-%m-%d", time());
    $strDate = explode("-", $today);
    $fday = $strDate[2]; $fmonth = $strDate[1]; $fyear = $strDate[0];
    $tday = $strDate[2]; $tmonth = $strDate[1]; $tyear = $strDate[0];
    $from_date = $today; $to_date = $today;
}

if(isset($_POST['PRINTED_YN'])){
    //show either all orderlines or just those noy yet printed
    $printed = $_POST['PRINTED_YN'];
}else{
    //must be first entry to page
    $printed = "ALL";
}

/*if(isset($_POST['UPDATE_STATUS'])){
    //validate all fields first
    $message = "";
    for($i = 1; $i <= $_POST['ROW_COUNT']; $i++){
        if ($_POST['PRINTED_' . $i] != "N" and $_POST['PRINTED_' . $i] != "Y"){
            $message .= "Printed status must be set to 'Y' or 'N'" . "<br/>";
            $warning = "red";
        }
    }
    if($message == ""){
        $rows_written = 0;
        for($i = 1; $i <= $_POST['ROW_COUNT']; $i++){
            //for each line of the table if the print status has changed then amend it
            if($_POST['PRINTED_' . $i] != $_POST['PRINTED_ORIGINAL_' . $i]){
                $fields = array("ol_id"=>$_POST['ID_' . $i], "ol_order_no"=>$_POST['ORDER_NO_' . $i], "ol_item"=>$_POST['ITEM_' . $i], 
                                "ol_printed"=>$_POST['PRINTED_' . $i], "first_printed"=>$_POST['FIRST_PRINTED_' . $i]);
                $rows = Rewrite_Order_Status($fields);
                if($rows == 1){
                    $rows_written ++;   
                }else{
                    $message .= "WARNING ! ! ! - Print status amendment failure (Order No." . $_POST['ORDER_NO_' . $i] . ") - Please contact SeeMyStory";
                    $warning = "red";
                }
            }
        }
        if ($message == "" and $rows_written == 0){
            $message = "No rows updated";
            $warning = "red";
        }
        if ($message == "" and $rows_written > 0){
            $message = "{$rows_written} rows successfully updated";
            $warning = "green"; 
        }
    }else{
        //refresh screen with original details
    }
}*/


// CUSTOMER ORDERS ------------------------------------------------------------------------------------------------------

$preferences = getPreferences();
//note this will also refresh the page after amending it
$pageTitle = "Site Administration: Amend Categories";
$pageMetaDescription = $preferences->PREF_META_DESC;
$pageMetaKeywords = $preferences->PREF_META_KEYWORDS;

//convert 16-02-2013 to 2013-02-16 00:00:00
//echo "DATES=" . $from_date . " to " . $to_date;


$orderlines = Get_All_Orderlines_Range($printed, pack_calendar_date($from_date, "from"), pack_calendar_date($to_date, "to"));

?>

<div class="matter">
        <div class="container">
            <div class="row">
                <div class="col-md-12">
                           <div class="padd">
                                <!-- Form starts.  -->
                                <form class="form-horizontal form-box" role="form" name="print_status" action="/_cms/list_orders.php" method="post">
                                <h4 class="form-box-header">List Orders <a href="#" class="tt"><?php echo ($preferences->PREF_TOOL_TIPS == "Y" ? "<img src=\"../images/q-icon.png\"><span class=\"tooltip\"><span class=\"top\"></span><span class=\"middle\">All trade/discount club members are listed here<br /><br />Details include name, user name, e-mail address and status</span><span class=\"bottom\"></span></span>" : "") ?></a></h4>
                                <div class="form-box-content">

                                            <?php
                                            foreach($errors_array as $e){
                                                echo "<label class=\"" . $warning ."\">" . $e . "</label><br/>";   
                                            }
                                            ?>

                                            <?php require_once('calendar/classes/tc_calendar.php'); ?>

                                                <div class="list_customers">
                                                    <div class="form-group">
                                                        <label class="control-label col-lg-4">From Date:</label>
                                                        <div class="col-lg-4">
                                                            <?php
                                                            //FROM DATE ---------------------------------instantiate class and set properties 
                                                            $myCalendar = new tc_calendar("from_date", true);
                                                            $myCalendar->setIcon("calendar/images/iconCalendar.gif");
                                                            $myCalendar->setDate($fday, $fmonth, $fyear);
                                                            $myCalendar->setPath('calendar'); //set path to calendar_form.php

                                                            //output the calendar
                                                            $myCalendar->writeScript();
                                                            ?>
                                                        </div>
                                                    </div>


                                                    <div class="form-group">
                                                        <label class="control-label col-lg-4">To Date:</label>
                                                        <div class="col-lg-4">
                                                            <?php
                                                            //TO DATE -----------------------------------instantiate class and set properties 
                                                            $myCalendar = new tc_calendar("to_date", true);
                                                            $myCalendar->setIcon("calendar/images/iconCalendar.gif");
                                                            $myCalendar->setDate($tday, $tmonth, $tyear);
                                                            $myCalendar->setPath('calendar'); //set path to calendar_form.php

                                                            //output the calendar
                                                            $myCalendar->writeScript();  
                                                            ?>
                                                        </div>
                                                    </div>


                                                    <div class="form-group">
                                                            <label class="control-label col-lg-4">All Orders:</label>

                                                            <div class="col-lg-1">
                                                                <input type="radio" name="PRINTED_YN" value="ALL" onchange="submit();" <?php echo ($printed == "ALL" ? "checked" : "")?> >
                                                            </div>
                                                    </div>

                                                    <div class="form-group">
                                                            <label class="control-label col-lg-4">Not Yet Downloaded</label>

                                                            <div class="col-lg-2">
                                                                <input type="radio" name="PRINTED_YN" value="N" onchange="submit();" <?php echo ($printed == "N" ? "checked" : "")?>></label>
                                                            </div>

                                                            <div class="col-lg-4">
                                                                <input name="SEARCH" type="submit" value="Search" class="btn btn-primary"/>
                                                            </div>
                                                    </div>




                                                <div class="form-group">   

                                                <table align="left" border="0" cellpadding="2" cellspacing="5" width="100%" style="text-align: left;">
                                                    <tr>
                                                        <th>
                                                           <label>Order No</label><br />
                                                        </th>
                                                        <th>
                                                           <label>Customer Name</label><br/>
                                                        </th>
                                                        <th>
                                                           <label>ID</label><br/>
                                                        </th>
                                                        <th>
                                                           <label>Date Created</label><br/>
                                                        </th>
                                                        <th>
                                                           <label>Last Download</label><br/>
                                                        </th>
                                                        <th>
                                                           <label>Product</label><br/>
                                                        </th>
                                                        <th>
                                                           <label>Descripion</label><br/>
                                                        </th>
                                                        <th>
                                                           <label>Qty</label><br/>
                                                        </th>
                                                        <th>
                                                           <label>Price</label><br/>
                                                        </th>
                                                        <!--
                                                        <th>
                                                           <label>Downloaded</label><br/>
                                                        </th>
                                                        -->
                                                    </tr>
                                                    <?php $cntr1 = 0; ?>


                                                    <?php foreach($orderlines as $o): ?>

                                                    <?php
                                                       if (is_array($orderlines))
                                                        {
                                                            foreach ($orderlines as $o)
                                                            {

                                                            }
                                                    }
                                                    ?>

                                                        <?php 
                                                            $cntr1 ++;
                                                            $orderno = $o->OL_ORDER_NO;
                                                            $customer = Get_Customer_From_Orderline($orderno);
                                                            $original = $o->OL_PRINTED;
                                                        ?>
                                                        <tr>
                                                            <td>
                                                                <!--<a href="/_cms/list_order_detail.php?order=<?php echo $o->OL_ORDER_NO ?>"><span class="member_line"><b><?php echo $o->OL_ORDER_NO ?></b></span></a>-->
                                                                <span class="member_line"><b><?php echo $o->OL_ORDER_NO ?></b></span>
                                                                <input name="ORDER_NO_<?php echo $cntr1 ?>" type="hidden" value="<?php echo $o->OL_ORDER_NO; ?>" />
                                                            </td>
                                                            <td>
                                                                <span class="member_line"><?php echo $customer->CS_USERNAME; ?></span>
                                                            </td>
                                                            <td>
                                                                <span class="member_line"><?php echo $customer->CS_ID; ?></span>
                                                            </td>
                                                            <td>
                                                                <span class="member_line"><?php echo unpack_date($customer->OR_DATE_CREATED); ?></span>
                                                            </td>
                                                            <td>
                                                                <span class="member_line"><?php echo unpack_date($o->OL_LAST_PRINTED); ?></span>
                                                            </td>
                                                            <td>
                                                                <span class="member_line"><?php echo $o->OL_ITEM; ?></span>
                                                                <input name="ITEM_<?php echo $cntr1 ?>" type="hidden" value="<?php echo $o->OL_ITEM; ?>" />
                                                            </td>
                                                            <td>
                                                                <span class="member_line"><?php echo $o->OL_DESC; ?></span>
                                                            </td>
                                                            <td>
                                                                <span class="member_line"><?php echo $o->OL_QTY; ?></span>
                                                            </td>
                                                            <td>
                                                                <span class="member_line"><?php echo $o->OL_PRICE; ?></span>
                                                            </td>
                                                            <td>
                                                                <input id="PRINTED_<?php echo $cntr1 ?>" name="PRINTED_<?php echo $cntr1 ?>" type="hidden" SIZE="1" onblur="this.value=this.value.toUpperCase()" value="<?php echo $o->OL_PRINTED;  ?>" />
                                                                <input name="PRINTED_ORIGINAL_<?php echo $cntr1 ?>" type="hidden" value="<?php echo $original ?>" />
                                                                <input name="ROW_COUNT" type="hidden" value="<?php echo $cntr1; ?>" />
                                                            </td>
                                                        </tr>
                                                    <?php endforeach;?>


                                                    <div class="form-group">                                                    
                                                        <label class="<?php echo $warning ?>"><?php echo $message ?></label>
                                                    </div>

                                                    </table> 
                                                    </div>
                                </form>
                                </div>
                            </div>
                </div>
            </div>
        </div>
    </div>
</div>

    <!-- Matter ends -->



<?php

include 'includes/footer_notificationbox.php';

?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.