Page 1 of 1

using onload and window.open with php

Posted: Wed Jul 30, 2003 11:59 am
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. :?:

Posted: Wed Jul 30, 2003 1:26 pm
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.

I'm an idiot

Posted: Thu Jul 31, 2003 1:47 pm
by jc_262002
yeh i'm an idiot. Been using php 4ever can't believe i missed that.

thanks for the help jollyjumper.

Posted: Fri Aug 01, 2003 1:32 am
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.