#1
  1. funky munky
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jul 2001
    Location
    UK
    Posts
    1,446
    Rep Power
    16

    javascript and php - a refreshing post (*groan*)


    Ok, I asked a question in here about resolution sniffing and PHP a while back and the question was resolved very nicely... I'm hoping someone can help again!

    The problem regards refreshing one window from another using the javascript 'opener.location.reload()' call.

    I have a script to allow users to add a gig for their band. At a point in the script, they have the option to click a link which adds a new venue if the venue they're playing at is not currently listed.

    On clicking the link, a new window opens and the code for adding a new venue is invoked.

    After successfully adding a new venue, the venue window is closed and the referring window (the gigs screen) is refreshed to reflect the changes made to the venues list.

    This is achieved using the following php after successfully adding a venue:
    PHP Code:
    if($refered){
    $html="<html><head><title>New Venue "
    ." Added</title></head>"
    ."<body bgcolor=#336699 onload=\"settimeout(window.close(),5000); opener.location.reload();\">"
    ."<br>New venue added - please close this window!"
    ."</body></html>";
    print(
    $html);
    exit;


    However I cannot get the referring window to refresh with this code... does anyone have any ideas?

    PS - see the instructions in one of my replies on the JS forum to see an example:
    http://forums.devshed.com/showthread...3690#post73690
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Location
    In nederland
    Posts
    41
    Rep Power
    15
    now it is javascript ;0)
    window.location.reload...
    maybe "document.location=whereeveryouwannego.php"
    [PHP]
    <?if($refered){?>

    <html><head><title>New Venue Added</title></head>
    <body bgcolor=#336699>

    <SCRIPT>
    settimeout(window.close(),5000);
    window.location.reload();
    </SCRIPT>

    <br>New venue added - please close this window!
    </body></html>

    <?}?>
    [PHP]

IMN logo majestic logo threadwatch logo seochat tools logo