Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

complicated refresh

refresh php



2:09 am on Jul 30, 2004 (gmt 0)

Inactive Member
Account Expired



i have a php page which is a list of songs and one of the fields for each song is 'listens'. This field denotes how many times the song has been played.

When the song link is clicked, it opens another php script which does some simple calcs, updates the 'listens' field by incrementing it by 1 and then the script used the

header ("Location: $page");

function to redirect the user to the song in question. The song then starts downloading/playing in WMP or Real or whatever.

While the 2nd script is doing it's stuff, the original page which lists the songs, sits as it is without changing. This is good as the user can continue to browse my songs, but i'd like the 'listens' field to be refreshed. It's a small touch but one i would like to be able to do.

I want to be able to use the 2nd script to open the song but also to refresh the page which lists the songs. I can use the 'header:location' function to do both of these things in the 2nd script, open the song or refresh the page, but you can't have 2 headers in there at the same time as only one of them is activated. i have to make a choice between updating the page and activating the song for the user and the song wins. I want to do both tho.

Does anyone know how i can get around this problem. I saw a lot of talk about meta-refresh in earlier posts but can't figure out how to use this in my circumstances. and obviously the only 'header:location' function i can use has been used.

The page with the list of songs is in a frame. Can i get the 2nd script to send some code to that frame to make it refresh? Or even just send a request to that frame which gets it to load a webpage and i could make the webpage the same as it already was. In effect this would refresh the page. Someone mentioned Iframe but again, i can't see how i could apply that.

This is driving me nuts! It's probably really simple tho.....

4:15 am on July 30, 2004 (gmt 0)

New User

10+ Year Member

joined:July 22, 2004
votes: 0

on page1 include at the body tag

<body onload="parent.yourframenameofpage2.location='some.refresh.location';">