tomyknoker
09-02-2007, 01:40 AM
I have a logout button in my top frame, when it's hit it runs:
<?php
session_start();
#### log out by destroying the session! #####
session_destroy();
header('Refresh: 0; url=music.php');
?>
But I also want the bottom frame to be refreshed... Can this be done in php? Can I target the frame?
Mwnciau
09-02-2007, 01:56 AM
Can't be done in PHP without echoing javascript
tomyknoker
09-02-2007, 02:01 AM
Ahhhhh bummer so can I do it with my current file? So do I need to have another file which contains js?
Mwnciau
09-02-2007, 02:35 AM
No, you can do it like:
<?php
echo '<script type="text/javascript">parent.bottomframe.location = "page.php";</script>';
I just don't know the correct javascript
tomyknoker
09-02-2007, 02:51 AM
Wow that worked!!!! Now I tried to edit the signup file, becuase I need to refresh the top frame on signup... I added the top line to the authenticate.php, which refreshes the frame in the top... but the bottomFrame has the error below...
closeDatabase($rs, $dbConnection);
echo '<script type="text/javascript">parent.mainFrame.location = "music.php";</script>';
header("location:home.php");
And the error:
Warning: Cannot modify header information - headers already sent by (output started at /home/html/authenticate.php:80) in /home/html/authenticate.php on line 81
Mwnciau
09-02-2007, 02:57 AM
remove the header and just use javascript:
echo '<script type="text/javascript">parent.mainFrame.location = "music.php";window.location = "page.php";</script>';
GO ILLINI
09-02-2007, 03:05 AM
you cant change the header information after anything has been printed onto a page.(even if its just jsut a space/linebreak)
-Adam
tomyknoker
09-02-2007, 03:28 AM
Mwnciau dude perfect works flawlessy now thanks heaps!!!