
July 24th, 2001, 12:34 AM
|
|
Member
|
|
Join Date: Feb 2001
Posts: 4
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
PHP and Javascript
Hi,
Can someone help me with this:
I've a page called: index.php
I want to add a variable 'w'with the screen width so I can use the variable 'w' for php purposes.
Here's the code I use now:
<?php
if ( !isset($w) ) { ?>
<SCRIPT language="JavaScript">
<!--
var w = screen.width;
window.location.replace("<?php echo (basename($PHP_SELF) ?>?w=" + w );
//-->
</SCRIPT>
This works fine when there all no other variables after index.php, but what if there's already an index.php?x=10
How can I adjust the script so I get
index.php?w=1024
or
index.php?x=10&w=1024
when needed?
Thanx,
Marcel
|