Jump to content

header("Location ... Problem in PHP 5


larswise

Recommended Posts

Hello,

I just upgraded my PHP to v5 and one of my scripts doesn't seem to work anymore (the script taking care of my orders). The script was written about two years ago and worked fine with php 4.2.3, It's an ugly script but it does (did) the job.

The problem is when i output my head.inc file (with html) before a header("Location: $var"); it simply stops and just displays an empty page with header.inc and footer.inc.

The code looked like this:

include 'head.inc';
if(strcmp($_GET['action'], "subm") == 0) {
if($_GET['step'] == "start" || $_GET['ccat'] == "select") {

when i reach the redirect code, the $_GET['action'] is still set to "subm"

I tried:

if(strcmp($_GET['action'], "subm") == 0) {
if($_GET['step'] == "start" || $_GET['ccat'] == "select") {
include 'head.inc';

But then, as the script is made, the page displays without any html header when neither step == start or ccat == select :)

Is there any good workaround to force a redirect even if HTML is outputted ?

Thanks in advance

Lars



Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.