473,326 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Re: if statement in an elseif block with a preceeding exit statement

JRough <jl*****@yahoo.comwrote:
>
You are right there was a missing ' " '

However, there is still a syntax problem with the if inside the elseif
which was my original question.

}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://allcapitalrailmanagement.com/fakerockridge/tracing_reportsXL.php?param=".$_POST['redirect']."&id=['id']);
exit;
}
}
More than the syntax problems, you also have a logic problem here. How do
you think that "if" statement is ever going to be hit, given the statement
immediately before it?
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jul 31 '08 #1
3 2522
>
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;
}
?>
Jul 31 '08 #2
tax problems, you also have a logic problem here. *How do
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.
The error I get now is:

Parse error: syntax error, unexpected T_STRING in /home/dhandler/
public_html/fakerockridge/tracing_reports.php on line 75
Jul 31 '08 #3
JRough <jl*****@yahoo.comwrote:
>
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.
A single HTTP request can only redirect to one place at a time, and if you
are redirecting with a "Location" header, that page is done.

It sounds kind of like you have a chain of requests here. You have a form
on page A; user fills in some information and does a submit, which brings
up page B. User makes some other entry, which redirects to your Excel
download. Is that right? Then clearly, the redirect to Excel has to
happen in the processing for page B. If you have to pass some fields
between them, then you either need a long URL in the Location header, or
you need to use Javascript to do a POST instead.
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Aug 2 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jay | last post by:
G'day all This registration form checks for the submit button then displays the next form from the include statement. But before it displays the next form it will check to make sure the user...
94
by: John Bailo | last post by:
The c# *return* statement has been bothering me the past few months. I don't like the fact that you can have different code paths in a method and have multiple return statements. To me, it...
2
by: thx606 | last post by:
Hello, I'm having some trouble with my code below. One of my If statements causes the code not to work. If I take the If Statement out it runs fine. I highlighted the area that I'm having...
0
by: HK | last post by:
I have an inventory form designed in continuous format so that users can edit quantity on hand information. I have numerous filters set up because the inventory table holds sever hundred thousand...
11
by: =?Utf-8?B?Um9nZXIgVHJhbmNoZXo=?= | last post by:
Hello, I have a question about the infamous GOTO statement and the way to return a result from a sub: I have a sub that has to make some calls to external COM methods, and because these...
17
by: JRough | last post by:
I'm trying to get error proof code. I have this code which seems to work but now I look at it I think it should be elseif not else and I wonder why it works. It is in the block:...
0
by: thelma | last post by:
JRough <jlrough@yahoo.comwrote: : However, there is still a syntax problem with the if inside the elseif : which was my original question. : }elseif($_POST&&$_POST!=$_SERVER){ : ...
13
by: scottbouley | last post by:
HELP! I'm trying to check a form for missing values. Two of the fields are required and therefore the corresponding message boxes are VBOkOnly. The other two are for warning purposes and their...
15
by: squrel | last post by:
Hello All.. I m having some problem here.. i m using VB6 and SQLServer 2000... i m getting this error " statement invalid outside type block" i m sending u the code and the bold line is where i m...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.