i am using of header() in my script(my script name is: login.php):

header("location: send.php");
exit();

it works correct.

but when i use of it in frame in html, header() doesn't work!!

<iframe style="WIDTH: 100%; HEIGHT: 700px" border="0" name="I1" align="center" src="http://www.domain.com/login.php" frameborder="0" scrolling="no"></iframe>

any one know why?

    You are suppose to use the full http link in header, but I doubt if this is the problem.

    In what manner doesn't it work?

      header() in http://www.domain.com/login.php works correctly and it redirect to http://www.domain.com/send.php when i use of this url directly in address bar of internet explorer

      but when i use of it in html farme (that i want to use of this script in other site) header in login.php script does not work and it does not redirect to send.php.

      i know now that it does not work only on internet explorer 7! on internet explorer 6 frame works coccrelty and it redirects.

      and one know why?

        What does it do instead of redirecting?

        Is it a cookie problem, sigh, I remember my teacher saying "Not enough information"

          no things happens. when it comes to header() script stopped! and it does not redirect to send.php

            Try it with the full URI, I found IE7 didn't might the relative header() but Firefox didn't like it at all.

            From the php manual.

            ????: HTTP/1.1 requires an absolute URI as argument to Location: including the scheme, hostname and absolute path, but some clients accept relative URIs. You can usually use $SERVER['HTTP_HOST'], $SERVER['PHP_SELF'] and dirname() to make an absolute URI from a relative one yourself:

              in other mean you say i must use of:

              header("location: http://www.domain.com/send.php"); 
              exit(); 
              

              i changed my script to this but the problem not solved and header does not work in frame.

                Is display_errors set to On and error_reporting set to E_ALL ?

                Also note that using a header() call inside of a frame will only change that frame's location - not the entire window (e.g. what you see in the address bar).

                  yes display_errors seted to On and error_reporting set to E_ALL but there is no error!
                  yes. i know using a header() call inside of a frame will only change that frame's location.
                  but it is very strange. header() works correctly in my script when i run my script directly (form address bar).
                  but when i run my script into frame of one other site header() does not work! and no things happens. it is very strange.

                    after very research i found problem and i opend new thread for help.
                    thank all

                      Write a Reply...