views:

31

answers:

1

Hello.

I have my integrated my site with phpbb, so you login into phpbb, and then you will be able to see my site, so I do not use normal sessions, so I do not know how to do this.

My site is a design at index.php, and then I have an insert.php inside a frame. Now at my index.php, I want to receive a message, and at insert.php, I want to send a message.

Understand me correctly, after there has been inserted something in the database in insert.php, I want to display a message like StackOverflow (in index.php) saying "You have received + points". Now I do not know how to "pass" the message.

I mean, from insert.php, to index.php.

And then I have been thinking of making an auto refresher each 2 seconds, to check if there are any new messages to display.

Thank you, Azzyh

And forgot to mention: My index.php is on / My insert.php is in /videos/insert.php At /videos/show.php, you type the comment, and then, Insert.php inserts the comment to the database, Ive did a script in show.php that sends string to insert.php, and then insert.php inserts, and then it outputs results in a that i have in show.php ( such as "Successfully inserted!"). So should i really do something in the insert.php or in the script, if succeed inserting? Here's my script i was mentioned:

var nocache = 0;
function insert() {
// Optional: Show a waiting message in the layer with ID login_response
document.getElementById('insert_response').innerHTML = "To Sek .. "
// Required: verify that all fileds is not empty. Use encodeURI() to solve some issues about character encoding.
var fID= encodeURI(document.getElementById('fID').value);
var kommentar= encodeURI(document.getElementById('kommentar').value);
// Set te random number to add to URL request
nocache = Math.random();
// Pass the login variables like URL variable
http.open('get', 'insert.php?fID='+fID+'&kommentar=' +kommentar+'&nocache = '+nocache);
http.onreadystatechange = insertReply;
http.send(null);
}
function insertReply() {
if(http.readyState == 4){
var response = http.responseText;
document.getElementById('insert_response').innerHTML = ''+response;
}
} 
+1  A: 

In the parent page (index.php) define a javascript function that you could invoke from the child page:

function someFunction(msg) {
    alert(msg);
}

and in the child page (insert.php) you may invoke this function:

if (window.parent) {
    window.parent.someFunction('hello world');
}

Note that due to cross domain policies this will work only if the two pages are on the same domain.

Darin Dimitrov
Hello Darin. Please read my updated answer, i got a issue using this, because as i said in my updated answer, that i am using a script to insert the comment and output response (so you have all in one page)..
Karem