logic problem



There are 3 ways to view this page. First it draws the page and there
is a html form with 4 radio buttons to select which query to view,
Idle cars, current sightings, bad orders ... Also drawn on the page
is TPL_ids a string that draws a list box with lists of leases. The
user can select one of the car leases. Lastly the user can either
select the lease to view and see the data in the page ( 1st elseif )or
choose to download to Excel ( last elseif)

the logic problem appears to be the last elseif butknow how to fix it
or where to put the if for the Excel???

[note:The param is the $id. The radio choice is called for some
reason 'redirect'. On the tracing_reportsXL.php page I capture that
with session variables so I don't need to pass anything in the last
elseif.]

Right now it is not redirecting to the excel page even when I click
the button, nothing is happening. My guess is it doesn't get as far
as the last elseif.

If I knew how to rewrite the page I would, thanks.
Janis
if(empty($id)&&($_SESSION["LMS_USER_DESC"]=='internal')){

# THIS IS id INSTEAD OF lease_id B/C ONE DAY WE MIGHT HAVE CUSTOMER
SUB GROUPS OR MANAGED CARS
$destroyed = GetDestroyed_lease_id();
$result = SELECT_leasesCLM();
$TPL_ids = "<SELECT name='id' class=box size=8>\n";
$trbg = "";


while($row = mysql_fetch_assoc($result)){
$id = $row['lease_id'];
$lnum = $row['lease_num'];
$comp = $row['comp_name'];

$trbg = GetTRBG($trbg);

$TPL_ids.=" <OPTION VALUE='".$id;
$TPL_ids.="' ".$trbg.">".$lnum." - ".$comp."</OPTION>\n";
}
$TPL_ids.="</SELECT>\n";


include "header.php";
include $template_path."tracing_reports_php.html";
}elseif($_POST['redirect']&&$_POST['redirect']!=$_SERVER['PHP_SELF']){
Header("Location: ".$_POST['redirect'].".php?id=".$_POST['id']);
include "footer.php";

}elseif($_POST['assign']=='Open in Excel'){
Header("Location: http://xxx/fakerockridge/tracing_reportsXL.php";);
exit;
}





function SELECT_leasesCLM(){
$query = "SELECT DISTINCT l.lease_id, m.lease_num, co.comp_name
FROM INTERNAL_LEASES l, INTERNAL_MASTER_LEASE m, INTERNAL_COMPANY
co,
INTERNAL_CAR_LEASE cl, INTERNAL_REMARK r, INTERNAL_CLM c
WHERE co.comp_id = m.comp_id
AND m.master_lease_id = l.master_lease_id
AND l.lease_id = cl.lease_id
AND cl.end_date IS NULL
AND cl.remark_id = r.remark_id
AND r.car_mark = c.car_mark
AND r.car_number = c.car_number";
$result = mysql_query($query);
if(!$result){
MySQLError($query);
exit;
}
return $result;
}
.


Quantcast