if statement in an elseif block with a preceeding exit statement



I get this error message with this page:
"Parse error: syntax error, unexpected T_STRING in /home/dhandler/
public_html/fakerockridge/tracing_reports.php on line 74". It is just
an if/else problem.


The line 74 is here:
if($_POST['assign']=='Open in Excel'){


The preceeding elseif line has to go first:

}elseif($_POST['redirect']&&$_POST['redirect']!=$_SERVER['PHP_SELF']){
Header("Location: ".$_POST['redirect'].".php?id=".$_POST['id']);
exit;
First we must know if there has been a selection or if the page is
just being presented. This POST redirect is an option button named
'redirect' from the tracing_report_php.html page. It selects what
type of query to run on the lease_id. For example, here is one line
from the form: <td a><input type='radio' name='redirect'
value='current_sightings' checked></td><td>Current Sightings</td>


There are 2 selections the user makes when presented with this page.
The other one is the id in the while loop. It is just a box with a
list of leases the internal wants to check on and makes a selection.
This is the id that gets posted to the tracing_reportsXL.php page.

My problem is where to stick this so I can get it to download to Excel
if the user wants that option as well once he sees his data.
if($_POST['assign']=='Open in Excel'){

Where I put it didn't work because of the exit in the elseif but it
should be evaluated after the elseif. If I make it another elseif,
then it won't check to see if the user made a selection from the 4
radio option buttons named redirect.

Many thanks,
-------------
//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";
include "footer.php";
}elseif($_POST['redirect']&&$_POST['redirect']!=$_SERVER['PHP_SELF']){
Header("Location: ".$_POST['redirect'].".php?id=".$_POST['id']);
exit;

if($_POST['assign']=='Open in Excel'){
Header("Location: http://xxx.com/fakerockridge/tracing_reportsXL.php?param=".$_POST['redirect']."&id=['id']);
exit;
}
}



######################################
##
## 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;
}
.


Quantcast