hi all
I'm having trouble getting something simple working and can't see why.
This is the code I'm running:
<?php if ($row_Recordset 1['type']=="agent"){
header("Locatio n: agentindex.php" );
echo "AGENT";
exit;
}
else
{
header("Locatio n: llindex.php");
echo "LANDLORD";
exit;
}
?> 3 1605
AJ wrote: I'm having trouble getting something simple working and can't see why.
Are you getting errors? If so, what are they?
header("Locatio n: agentindex.php" );
This will force most browsers to redirect immediately. You should also
specify the full URI, rather than the file name alone.
echo "AGENT";
This may never be executed, or rather may never be seen inthe browser as
it will be replaced with the page to which you have just redirected.
header("Locatio n: llindex.php"); echo "LANDLORD";
Likewise
If you are getting headers already sent errors, you script is outputting
something before the location call (even one white space character).
Check the manual for Output control and for headers: http://uk2.php.net/manual/en/ref.outcontrol.php http://uk2.php.net/header
Hope this helps, regards,
Andy
"Andy Barfield" <ab**********@y ahoo.com> wrote in message
news:q6******** ************@ni ldram.net... AJ wrote: I'm having trouble getting something simple working and can't see why. Are you getting errors? If so, what are they?
I've actually managed to sort it. I've found two things to watch out for:
1. Probably obvious, but it wasn't to me. I'd put the PHP with the header
information inside the <BODY> of the page
2. It would appear that any white space after the header call messes things
up. Even a space after the ; will cause it not to work
Does that sound feasible?
Andy
Sorry - been away for a couple of days, didn't see your reply.
AJ wrote: 1. Probably obvious, but it wasn't to me. I'd put the PHP with the header information inside the <BODY> of the page
Yep, that would do it - the headers must be sent before any other output
to the browser, even a space before the <?php tag will stop it working
and give you a "headers already sent" error.
2. It would appear that any white space after the header call messes things up. Even a space after the ; will cause it not to work
Not seen that happen before. I often use the Location header in an
if-else block like
if(!something)
{
header("Locatio n: http://somewhere.else/");
exit;
}
else
{
echo "I have not reditected you";
}
Regards,
Andy This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: John |
last post by:
Hi.
I am having a few header problems at the moment with a login page. I
don't have my headers at the top of the page where I've learned I need
to have them. However, I also know I'm supposed to have the
session_start(); at the top of the page as well. So when you have two
things that need to be the first which do you put first? And if I put
one before the other will that cause problems?
Below is a copy of the php from my page. It...
|
by: Steven T. Hatton |
last post by:
In the past there have been lengthy discussiions regarding the role of
header files in C++. People have been very adamat about header files
serving as in interface to the implementation. I do understand the
objective. This example may represent an interface in need of a bit of
refactoring, but it goes to demonstrate the basic idea as I understand it.
http://developer.kde.org/documentation/library/cvs-api/kdevelop/html/ast_8h-source.html...
|
by: Derrick Coetzee |
last post by:
It seems like, in every C source file I've ever seen, there has been a
very definite include order, as follows:
- include system headers
- include application headers
- include the header associated with this source file
For example, in a file hello.c:
#include <stdio.h>
|
by: John Smith |
last post by:
Hi all
What does the group think of the practise of including one header file from
inside another?
I have some legacy code where this has been done, and it creates a
dependency on a module (collection of files) which are not required, except
for one header file's contents.
I'd say 'No, header files should be included in the C source, not in another
|
by: Jason Collins |
last post by:
There seems to be an inconsistency (bug?) in the way the Set-Cookie header
is handled by the WebHeaderCollection. That is, the values of Set-Cookie,
when an Expires is specified, contain the "," character. This seems to be
incorrectly parsed during GetValues().
A simple example shows it best (there are 2 .aspx pages and an output):
AddHeaders.aspx:
<%@ Page language="c#" %>
| |
by: Dean Hallman |
last post by:
Hello,
I am developing a BHO that should add a custom HTTP header on a
specific domain only. Don't want the header globally, otherwise I
could just add a registry key.
So, on BEFORENAVIGATE2, I am canceling the current navigation and
renavigating with the new custom header using Navigate2. This usually
works fine, but in some cases (particularly when selecting a link that
starts a new window), the Navigate2 call fails.
|
by: Joseph Geretz |
last post by:
We use a Soap Header to pass a token class (m_Token) back and forth with
authenticated session information. Given the following implementation for
our Logout method, I vastly prefer to simply code m_Token = null in order to
destroy the session token when the user logs out. However, I'm finding that
setting class instance to null results in no header being sent back to the
client, with the result that the client actually remains with an...
|
by: Shalako |
last post by:
I check my error log and see these entries:
malformed header from script. Bad header= Missing gauge reports are ind: padata.pl
/perl/pema/padata.pl did not send an HTTP header
malformed header from script. Bad header= : padata.pl
/perl/pema/padata.pl did not send an HTTP header
malformed header from script. Bad header= Missing gauge reports are ind: padata.pl
/perl/pema/padata.pl did not send an HTTP header
malformed...
|
by: =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= |
last post by:
I have a sub in vb.net that adds extra headers to a gridview and it works
very well.
however, i tried to translate it to c# and i'm getting the header inserting
itself over the first datarows and inserting blank rows at the bottom.
i can post the code if necessary for the C# but it basicly mirrors the vb.net
--
(i''ll be asking a lot of these, but I find C# totally way cooler than vb
|
by: xiao |
last post by:
HI~ EVERY ONE~ I have a small program here, when I tried to compile
it , it always reminds that
arrary.c: In function `main':
arrary.c:39: error: `header' undeclared (first use in this function)
arrary.c:39: error: (Each undeclared identifier is reported only once
arrary.c:39: error: for each function it appears in.)
Why is that ? I think I have declared it . :(
|
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...
| |
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...
|
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,...
|
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...
|
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...
|
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...
|
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();...
| |
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |