using onload and window.open with php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jc_262002
Forum Newbie
Posts: 2
Joined: Wed Jul 30, 2003 11:59 am
Contact:

using onload and window.open with php

Post by jc_262002 »

I'm writing a simple chat program for my website and have everything done EXCEPT that i'm trying to use the following code to log users out when they leave the page.:

onunload="window.open('goodbye.php&username=<?php echo $username ?>', null, 'height=150, width=300, status=no, toolbar=no, menubar=no, location=no')"

the $username is a php variable passed win logging in and is used for who is online. The html produced looks correct.:

onunload="window.open('goodbye.php&username=admin', null, 'height=150, width=300, status=no, toolbar=no, menubar=no, location=no')"

but it will not work because the browser refuses to recognize goodbye.php when passing the variable $username(?username=admin). I need this page to load to remove the username from the online list. Can someone PLEASE HELP. :?:
jollyjumper
Forum Contributor
Posts: 107
Joined: Sat Jan 25, 2003 11:03 am

Post by jollyjumper »

Hi JC,

This is probably your problem:
goodbye.php&username --> goodbye.php?username

First variable needs to start with a ? instead of &

Greetz Jolly.
jc_262002
Forum Newbie
Posts: 2
Joined: Wed Jul 30, 2003 11:59 am
Contact:

I'm an idiot

Post by jc_262002 »

yeh i'm an idiot. Been using php 4ever can't believe i missed that.

thanks for the help jollyjumper.
jollyjumper
Forum Contributor
Posts: 107
Joined: Sat Jan 25, 2003 11:03 am

Post by jollyjumper »

oh well, some time ago I've been searching for a missing . for about 1,5 hours, and then my collegue looked at the line and saw it in just 30 seconds :D

Guess you were too much in it, so that you don't see the details anymore.(at least that's with me for most of the time, with these kind of silly problems).

Have a nice day.

Greetz Jolly.
Post Reply