...

View Full Version : window.location.reload



kurdishvoice
11-03-2004, 04:19 PM
im have this small piece of php code where it simply reloads the pageand changes th eid room but must keep the username the same.

the file checkuser.php passes the $username variable to login_success.php

this piece of code is in login_success.php


<SCRIPT>
var enablecookies="<?php echo $_REQUEST['on'] ?>";
var enablemenu="no";
var roomID = '<?php echo $roomID ?>';
var width = 600;
var height = 360;
var name = '<?php echo $username ?>';
var mode = 0;
</script>

function Room1()
{
window.location.reload('login_success.php?roomID=961&username=$username');
}


The code above works for the roomID but the username always changes, it must be the value from '<?php echo $username ?>' but i am not sure how to keep it constant.

jbot
11-03-2004, 04:44 PM
window.location.reload('login_success.php?roomID=961&username=$username');


you can't have the above in PHP. enclosing any variables inside single quotations, treats the entire thing as a string and therefore the variable doesn't get parsed.

you should use double quotes like this instead:


window.location.reload("login_success.php?roomID=961&username=$username");

or even like so:


window.location.reload('login_success.php?roomID=961&username='.$username);

kurdishvoice
11-03-2004, 05:36 PM
ok the code that seems to half work is this, the username remains the same and so does the roomID.


function Room1()
{
window.location.reload('login_success.php?roomID=962&username='.$username);

}

But that code has one problem the roomID does not change it always stays at 961, i needed the roomID to change. However if i was to right it like this


window.location.reload('login_success.php?roomID=962&username=.$username');

Then the roomID changes and so does the username but the username must remain constant.

skalla
02-18-2006, 05:04 PM
:thumbsup:
im have this small piece of php code where it simply reloads the pageand changes th eid room but must keep the username the same.

the file checkuser.php passes the $username variable to login_success.php

this piece of code is in login_success.php


<SCRIPT>
var enablecookies="<?php echo $_REQUEST['on'] ?>";
var enablemenu="no";
var roomID = '<?php echo $roomID ?>';
var width = 600;
var height = 360;
var name = '<?php echo $username ?>';
var mode = 0;
</script>

function Room1()
{
window.location.reload('login_success.php?roomID=961&username=$username');
}


The code above works for the roomID but the username always changes, it must be the value from '<?php echo $username ?>' but i am not sure how to keep it constant.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum