>
More than the syntax problems, you also have a logic problem here. *Howdo
you think that "if" statement is ever going to be hit, given the statement
immediately before it?
--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.
That was my original question! I did make some syntax errors because
I don't know how to pass paramaters in headers very well which I think
I have solved. That was my question though, where do I put the if for
the Excel button because it has to go after the page redrawing because
the user selects a choice in the html form in that redirect elseif.
That paramater has to pass to the Excel page and that determines which
query runs.
thanks,
<?
# * * * * ***********************************************
# * COPYRIGHT 2006 All Capital Rail Management ALL RIGHTS RESERVED
# * * * * ***********************************************
# * jkovac
# * 10.22.2007
# * current_sightings.php
# * PROVIDES THE LAST CLM FOR EACH CAR IN WHATEVER PARAMETER IS
PASSED: (lease, managed group, pool, etc)
# * modified by jrough
# * 7/15/2008
# * modified to add Excel button, see note
include './includes/config.inc.php';
include $include_path.'dates.inc.php';
include $include_path."LMS_functions.inc.php";
################################################
//Is the user logged in?
Validate_login("tracing_reports.php");
//if the $id is empty then one of the radio button options with name
'redirect' in the html form has not been posted
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']);
if($_POST['assign_x']=='Open in Excel'){
Header("Location: tracing_reportsXL.php".
$_POST['redirect']."&id=['id']));
exit;
}
}
include "footer.php";
######################################
##
## FUNCTIONS
##
######################################
################################
##
## QUERIES
##
################################
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;
}
?>