473,770 Members | 1,644 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 2572
>
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
13908
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
1094
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
40714
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
9432
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10232
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...
1
10008
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
9873
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...
0
8891
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5454
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3974
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.