View Full Version : Sending variable when window closes?

01-07-2007, 10:38 AM

I have a PHP/Javascript chatroom that has a private message capability. On the user list, when one user clicks another user's name, a window will pop up on each user's screen. The problem is, if either user closes his window, the other is able to keep typing and sending messages, but the user that closed the window doesn't get them. I want to fix this by either closing the other guy's window or reopening the window of the guy that closed it when the other guy sends a message. You can see the chatroom here: http://www.felweb.net/work/phpchat/

What I've been trying to do is to add a javascript code to the popup PHP file that asks the user if he's sure if he wants to close the window. If he clicks "OK", somehow it'll send a variable somewhere that'll force the other user's window to close also.
Alternatively, when the other user sends a message, the first guy's window would pop back up. But I'm not that good with PHP or Javascript so I need some urgent help :confused:

If you need to see any of the files, I zipped up the whole chat and you can download it here (i wasn't sure which ones to include so I posted them all): http://www.felweb.net/work/phpchat/FELIPECHAT.zip

All help is appreciated!
Thanks in advance!!

01-08-2007, 09:16 AM
You are not going to find many people that will help you with your solution. Number one there are quite a few files in there that will probably need changing. Number two is the fact that you have not really researched where the problem could be and/or the correct way to handle this. We are here to help you along with your solution, not re-write alot of code for you.