set header target in php
Results 1 to 5 of 5

Thread: set header target in php

  1. #1
    Senior Member
    Join Date
    Apr 2008
    Posts
    128

    Question set header target in php

    Hi

    I have a main.php page which contains 2 frames: left.php and right.php

    I set a logout function in left.php and redirect it to index.php

    When I click the logout function, only left.php redirect to index.php.

    header("Location: index.php Window-target: _parent"); not work

    Any idea?

  2. #2
    PHP Witch laserlight's Avatar
    Join Date
    Apr 2003
    Location
    Singapore
    Posts
    13,593
    Instead of performing the logout in left.php, perform the logout in index.php, based on some query string variable (e.g., index.php?logout=1). Then you can have a link in left.php to index.php that breaks out of the frames, and do not even need to use header().
    Use Bazaar for your version control system
    Read the PHP Spellbook
    Learn How To Ask Questions The Smart Way

  3. #3
    High Energy Magic Dept. NogDog's Avatar
    Join Date
    Aug 2006
    Location
    Ankh-Morpork
    Posts
    13,986
    Not positive, but you might want to try it as two separate headers (in this order):
    PHP Code:
    header('Window-target: _parent');
    header('Location: index.php'); 
    Note: to be HTTP/1.1 compliant, you should actually use the full URL for the location header value.

    Ultimately, probably the best solution would be to get away from using HTML frames at all, as the ancillary problems they bring with them tend to offset their usefulness (page bookmarking and search engine access to name a couple).
    Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be." ~ from Nation, by Terry Pratchett

    "But the main reason that any programmer learning any new language thinks the new language is SO much better than the old one is because hes a better programmer now!" ~ http://www.oreillynet.com/ruby/blog/...ck_to_p_1.html


    eBookworm.us

  4. #4
    Senior Member
    Join Date
    Apr 2008
    Posts
    128
    Both methods still cannot quit the frame and just left.php returned to index.php and right.php still be shown.

  5. #5
    PHP Witch laserlight's Avatar
    Join Date
    Apr 2003
    Location
    Singapore
    Posts
    13,593
    Both methods still cannot quit the frame and just left.php returned to index.php and right.php still be shown.
    If you are using my suggestion, your link must break out of the frame, i.e., with target="_top".
    Use Bazaar for your version control system
    Read the PHP Spellbook
    Learn How To Ask Questions The Smart Way

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •