473,785 Members | 2,568 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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($_PO ST['redirect']&&$_POST['redirect']!=$_SERVER['PHP_SELF']){
Header("Locatio n: ".$_POST['redirect'].".php?id=".$_P OST['id']);
exit;

if($_POST['assign']=='Open in Excel'){
Header("Locatio n:
http://allcapitalrailm anagement.com/fakerockridge/tracing_reports XL.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 2573
>
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_sightin gs.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.i nc.php";

############### ############### ############### ###
//Is the user logged in?
Validate_login( "tracing_report s.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_D ESC"]=='internal')){

# THIS IS id INSTEAD OF lease_id B/C ONE DAY WE MIGHT HAVE CUSTOMER
SUB GROUPS OR MANAGED CARS
$destroyed = GetDestroyed_le ase_id();
$result = SELECT_leasesCL M();
$TPL_ids = "<SELECT name='id' class=box size=8>\n";
$trbg = "";
while($row = mysql_fetch_ass oc($result)){
$id = $row['lease_id'];
$lnum = $row['lease_num'];
$comp = $row['comp_name'];

$trbg = GetTRBG($trbg);

$TPL_ids.=" <OPTION VALUE='".$id;
$TPL_ids.="' ".$trbg.">".$ln um." - ".$comp."</OPTION>\n";
}
$TPL_ids.="</SELECT>\n";
include "header.php ";
include $template_path. "tracing_report s_php.html";

}elseif($_POST['redirect']&&$_POST['redirect']!=$_SERVER['PHP_SELF']){
Header("Locatio n: ".$_POST['redirect'].".php?id=".$_P OST['id']);
if($_POST['assign_x']=='Open in Excel'){
Header("Locatio n: tracing_reports XL.php".
$_POST['redirect']."&id=['id']));
exit;
}
}

include "footer.php ";
############### ############### ########
##
## FUNCTIONS
##
############### ############### ########

############### ############### ##
##
## QUERIES
##
############### ############### ##
function SELECT_leasesCL M(){
$query = "SELECT DISTINCT l.lease_id, m.lease_num, co.comp_name
FROM INTERNAL_LEASES l, INTERNAL_MASTER _LEASE m, INTERNAL_COMPAN Y
co,
INTERNAL_CAR_LE ASE 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($qu ery);
if(!$result){
MySQLError($que ry);
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
18901
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 has entered details correctly and give error messages of whats missing before displaying the original form again. My problem is that I can't exit from the 'if' statement, it brings up the first form as desired, but I can't get it to quit there. I...
94
13910
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 would be more orthogonal if a method could only have one return statement. --
2
1278
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 problems with. If any one could help me with this, I thank you Private Sub SaveCmd_Click() Dim cancel As Integer
0
1095
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 records. Should I be using a form filter instead of the following code? I use the following function to change the forms record source. UpdateView is called anytime a user makes changes to the checkboxes, radio buttons, etc. Public Function...
11
3415
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 methods can fail I have to check them to be running ok, like this:
17
2462
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: if($_POST('assign']='Open in Excel')]...{ }elseif($_POST=='Open in Excel')]... ? shouldn't it be else instead of elseif? or should it be
0
199
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){ : Header("Location: ".$_POST.".php?id=".$_POST); : exit;-------------------------------------------^ /\missing close quote " : if($_POST=='Open in Excel'){
13
40715
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 message boxes are VBYesNo. First the code asks if the user wants to save the record. If the user answers Yes, the code should proceed to check for errors and allow the user to correct them. Once all of the errors are corrected a message box...
15
8685
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 getting the error can anyone help me.. i dont knw whr i m doing mistake.. thankx in advance Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10341
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10155
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9954
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7502
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.