|
Posted by dawnerd on 08/12/06 01:12
Platero wrote:
> 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
Use output buffering, should fix your problem.
[Back to original message]
|