larswise Posted October 7, 2006 Share Posted October 7, 2006 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 https://forums.phpfreaks.com/topic/23261-headerlocation-problem-in-php-5/ Share on other sites More sharing options...
wildteen88 Posted October 7, 2006 Share Posted October 7, 2006 Use output buffering in that caseAdd [code=php:0]ob_start();[/code] after the opening php tag (<?php) and [code=php:0]ob_end_flush();[/code] before the closing php tag (?>) Link to comment https://forums.phpfreaks.com/topic/23261-headerlocation-problem-in-php-5/#findComment-105463 Share on other sites More sharing options...
larswise Posted October 7, 2006 Author Share Posted October 7, 2006 wohAhoy! thank you! :DLars Link to comment https://forums.phpfreaks.com/topic/23261-headerlocation-problem-in-php-5/#findComment-105464 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.