You are here: headers sent issue « PHP Programming Language « IT news, forums, messages
headers sent issue

Posted by Platero on 08/11/06 20:05

Hi,
I've a stupid question but...

The code is the following:

if(($role!='tutor')&&(array_key_exists('tutor_id',$_GET)))
{
$possible_ids = array(2,6,7,8,9,10);
$t_id = $_GET['tutor_id'];

if(in_array($t_id, $possible_ids)){

$query="SELECT id_class FROM class WHERE
id_user='".$_GET['tutor_id']."'";

$id_class=$db->get_field($query,id_class);

include("print_data.php");

$formButtonLabel = "Modifica";

}

--->else

{

//$my_echo = "hello";
//echo $my_echo;

//header('Location: http://www.google.com');
//exit();
}

}




What happens:

if in the array there's what you have in $_GET, anything works.

It's the else block that matters: :-)
- if I ONLY print $my_echo, no problems;
- if I comment $my_echo and I leave the header() uncommented, this
command doesn't work (that is, the page does not redirect);

What is happening?
How can I solve this?

I tried (in the else block) the headers_sent function too:

if (headers_sent()) {
$my_echo = "sent";
echo $mioeco;
}

and it seems headers are sent, but maybe before I try to redirect.
Is there a way to "clean" the headers already sent??

Thanks very much,
Platero

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация