Please help me clear the cobwebs out???
I pretty much use session_start(); at the start of most/all of my PHP
programs and use the $_SESSION array to store control variables. This
technique seems to work quite well and is easily manages.
However, now I've come up to a situation where it's biting me and I need
some other ideas as to how to get around my situation.
In my PHP program I am in a logic block that requires to next page to be
delivered from a different server. If this were a link then I would use
the "href=" tag and when the user clicked on it control would go as
expected.
However, in this case I need control to go seamlessly and automatically. So
I thought I would use the header(location:) function and guess what? It
doesn't work because I have sessions and apparently sessions does something
that causes the headers to be disallowed.
I've evaluated trying to eliminate the sessions but this technique really
works so well and exactly was it is supposed to. So I am thinking that I
cannot be the only one whose come up against this before. Therefore, what
are OTHERS doing to accomplish this requirement (i.e.: using sessions and
still being able to automatically/seamlessly transition to a different
server without additional user input)?
I am most anxious to read what others are doing.
Thanks,
Bob 7 1278
*** bobmct escribió/wrote (Mon, 24 Jul 2006 15:57:01 -0400):
It doesn't work because I have sessions and apparently sessions does
something that causes the headers to be disallowed.
They shouldn't.
Sample code?
--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--
Will window.location.href work.
From:
<?php
header("location: somepage.php");
?>
To:
?>
<script language="javascript">
window.location.href = "somepage.php"
</script>
<?php
Javascript must be enabled in the browser settings.
bobmct wrote:
Please help me clear the cobwebs out???
I pretty much use session_start(); at the start of most/all of my PHP
programs and use the $_SESSION array to store control variables. This
technique seems to work quite well and is easily manages.
However, now I've come up to a situation where it's biting me and I need
some other ideas as to how to get around my situation.
In my PHP program I am in a logic block that requires to next page to be
delivered from a different server. If this were a link then I would use
the "href=" tag and when the user clicked on it control would go as
expected.
However, in this case I need control to go seamlessly and automatically. So
I thought I would use the header(location:) function and guess what? It
doesn't work because I have sessions and apparently sessions does something
that causes the headers to be disallowed.
I've evaluated trying to eliminate the sessions but this technique really
works so well and exactly was it is supposed to. So I am thinking that I
cannot be the only one whose come up against this before. Therefore, what
are OTHERS doing to accomplish this requirement (i.e.: using sessions and
still being able to automatically/seamlessly transition to a different
server without additional user input)?
I am most anxious to read what others are doing.
Thanks,
Bob
bobmct wrote:
Please help me clear the cobwebs out???
I pretty much use session_start(); at the start of most/all of my PHP
programs and use the $_SESSION array to store control variables. This
technique seems to work quite well and is easily manages.
However, now I've come up to a situation where it's biting me and I need
some other ideas as to how to get around my situation.
In my PHP program I am in a logic block that requires to next page to be
delivered from a different server. If this were a link then I would use
the "href=" tag and when the user clicked on it control would go as
expected.
However, in this case I need control to go seamlessly and automatically. So
I thought I would use the header(location:) function and guess what? It
doesn't work because I have sessions and apparently sessions does something
that causes the headers to be disallowed.
I've evaluated trying to eliminate the sessions but this technique really
works so well and exactly was it is supposed to. So I am thinking that I
cannot be the only one whose come up against this before. Therefore, what
are OTHERS doing to accomplish this requirement (i.e.: using sessions and
still being able to automatically/seamlessly transition to a different
server without additional user input)?
I am most anxious to read what others are doing.
Thanks,
Bob
Bob,
Sessions shouldn't be a problem. I use sessions and redirect at times,
and it works.
Ensure you aren't sending something else (even white space) out before
the header() call.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attglobal.net
==================
I always use sessions and redirect quite frequently. Also, I can see no reason why these are related. You must have sent SOMETHING. Are you sure you don't have any forgotten HTML piece of code, or another header, or a blank after your closing ?> statement?
Ronald :cool:
Manish wrote:
Will window.location.href work.
From:
<?php
header("location: somepage.php");
?>
To:
?>
<script language="javascript">
window.location.href = "somepage.php"
</script>
<?php
Javascript must be enabled in the browser settings.
bobmct wrote:
>Please help me clear the cobwebs out???
I pretty much use session_start(); at the start of most/all of my PHP programs and use the $_SESSION array to store control variables. This technique seems to work quite well and is easily manages.
However, now I've come up to a situation where it's biting me and I need some other ideas as to how to get around my situation.
In my PHP program I am in a logic block that requires to next page to be delivered from a different server. If this were a link then I would use the "href=" tag and when the user clicked on it control would go as expected.
However, in this case I need control to go seamlessly and automatically. So I thought I would use the header(location:) function and guess what? It doesn't work because I have sessions and apparently sessions does something that causes the headers to be disallowed.
I've evaluated trying to eliminate the sessions but this technique really works so well and exactly was it is supposed to. So I am thinking that I cannot be the only one whose come up against this before. Therefore, what are OTHERS doing to accomplish this requirement (i.e.: using sessions and still being able to automatically/seamlessly transition to a different server without additional user input)?
I am most anxious to read what others are doing.
Thanks,
Bob
Thanks to those who responded.
It appears that if NO output is done prior to the header() function then the
session_start() will still work.
Normally for debugging I display some variables as output and it appears
that is what was biting me.
As someone once said decades ago: "If the computer is smart enough to know
its incorrect, then why isn't it smart enough to correct it?"
Thanks again,
Bob
bobmct <r.*********@fdcx.netXwrote:
It appears that if NO output is done prior to the header() function then the
session_start() will still work.
Normally for debugging I display some variables as output and it appears
that is what was biting me.
As someone once said decades ago: "If the computer is smart enough to know
its incorrect, then why isn't it smart enough to correct it?"
ob_start() is your friend.
miguel
--
Photos from 40 countries on 5 continents: http://travel.u.nu
Latest photos: Malaysia; Thailand; Singapore; Spain; Morocco
Airports of the world: http://airport.u.nu
*** bobmct escribió/wrote (Tue, 25 Jul 2006 17:06:40 -0400):
It appears that if NO output is done prior to the header() function then the
session_start() will still work.
PHP gives a warning when you do so. Try setting error_reporting to E_ALL
or, at least, E_ALL & ~E_NOTICE.
Normally for debugging I display some variables as output and it appears
that is what was biting me.
As someone once said decades ago: "If the computer is smart enough to know
its incorrect, then why isn't it smart enough to correct it?"
It could correct it, let's say, randomly ignoring some of your code? ;-)
--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
-- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Stijn Goris |
last post by:
Hi all,
I have a question regarding the header function. I send a browser to a
certain page (eg first.php ) wich sends no output to the browser. This page
sends the browser to another page (eg...
|
by: Johannes Bauer |
last post by:
Hi group,
I've got a question concerning inclusion of .hpp files. Currently I'm
including all needed header files in the .cpp file. This means all
dependencies of the package and all...
|
by: ben |
last post by:
is it true that a function without an inline keyword never get inlined? If
not true when is it inlined or not?
ben
|
by: Joey Martin |
last post by:
This is more of a flash recommendation question than ASP related, but I
use this forum a lot, so wanted to see if anyone can answer.
My page header is flash. One the header is flash. It's about...
|
by: somenath |
last post by:
Hi All ,
As a process of my C language learning I was trying to learn how
malloc can be implemented from K&R2 .But I am not able to
understand few points . It would be very much helpful if...
|
by: sheldonlg |
last post by:
VK wrote:
This sounds like what I was looking for.
I haven't done this before so I have a few (probably elementary)
questions. I assume that I would have to add that header at the server
side...
|
by: Bryan Parkoff |
last post by:
I write my large project in C++ source code. My C++ source code
contains approximate four thousand small functions. Most of them are
inline. I define variables and functions in the global scope....
|
by: sheldonlg |
last post by:
I am looking for a clean solution to a problem that I solved in, what I
call, a "dirty" way.
Here is what I want to do. I have a dropdown list. Clicking on an item
in the dropdown list invokes...
|
by: Mark |
last post by:
so, i'm making a website. let's say i have header.php, footer.php and
content.php.
now in index.php I simply want to include the 3 pages. easy enough to
do.
but let's say the user navigates to...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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,...
|
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...
| |